Remove final GET on POST 202 long running operations (#103)

* Remove final GET on POST 202 long running operations

* Bump the version to 1.3.0

* Remove unnecessary request mock
This commit is contained in:
Kamil Pajdzik 2019-01-07 12:32:00 -08:00 коммит произвёл GitHub
Родитель 7862424f22
Коммит cee5adbef6
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 7 добавлений и 13 удалений

Просмотреть файл

@ -507,7 +507,7 @@ class AzureAsyncOperationLROPollStrategy extends LROPollStrategy {
if (lroPollState.locationHeaderValue) {
const initialResponseStatusCode: number = initialResponse.status;
if (initialRequestMethod === "POST") {
result = initialResponseStatusCode === 200 || initialResponseStatusCode === 201 || initialResponseStatusCode === 202;
result = initialResponseStatusCode === 200 || initialResponseStatusCode === 201;
} else if (initialRequestMethod === "DELETE") {
result = initialResponseStatusCode === 200 || initialResponseStatusCode === 202;
}
@ -579,4 +579,4 @@ class GetResourceLROPollStrategy extends LROPollStrategy {
protected doFinalGetResourceRequest(): Promise<void> {
return this.sendPollRequest();
}
}
}

Просмотреть файл

@ -5,7 +5,7 @@
"email": "azsdkteam@microsoft.com",
"url": "https://github.com/Azure/ms-rest-azure-js"
},
"version": "1.2.4",
"version": "1.3.0",
"description": "Isomorphic Azure client runtime for Typescript/node.js/browser javascript client libraries generated using AutoRest",
"tags": [
"isomorphic",

Просмотреть файл

@ -2164,20 +2164,14 @@ describe("AzureServiceClient", () => {
body: {
status: "Succeeded"
}
},
{
status: 200,
body: {
a: "A"
}
}
]);
const httpRequest = new WebResource("https://fake.azure.com/longRunningOperation", "POST");
const httpResponse: HttpOperationResponse = await serviceClient.sendLongRunningRequest(httpRequest);
assert.strictEqual(httpResponse.status, 200);
assert.strictEqual(httpResponse.bodyAsText, `{"a":"A"}`);
assert.deepEqual(httpResponse.parsedBody, { a: "A" });
assert.strictEqual(httpResponse.request.url, "https://fake.azure.com/longRunningOperation3");
assert.strictEqual(httpResponse.bodyAsText, `{"status":"Succeeded"}`);
assert.deepEqual(httpResponse.parsedBody, { status: "Succeeded" });
assert.strictEqual(httpResponse.request.url, "https://fake.azure.com/longRunningOperation2");
});
describe("Headers: Location", () => {
@ -2601,4 +2595,4 @@ function createServiceClient(responses: HttpResponse[]): AzureServiceClient {
},
longRunningOperationRetryTimeout: 0
});
}
}