Handle 404 properly in the final GET of an LRO DELETE operation

This commit is contained in:
Amar Zavery 2019-06-01 17:46:11 -07:00
Родитель 74c3955b0a
Коммит 8f1e918170
4 изменённых файлов: 52 добавлений и 9 удалений

1
.gitignore поставляемый
Просмотреть файл

@ -74,6 +74,7 @@ Temporary Items
.apdisk
node_modules
*.tgz
#### JetBrains
.idea

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

@ -1,4 +1,44 @@
# Changelog
## 1.3.6 - 2019-06-03
- Fixed a bug where we were throwing an Error if the final GET on the resource while polling a long running DELETE operation would return a 404. [#azure-sdk-for-js/issues/2842](https://github.com/Azure/azure-sdk-for-js/issues/2842)
- Fixed vulnerabilities by updating package version of `nyc`.
## 1.3.5 - 2019-05-17
- Added missing exports to the package.
## 1.3.4 - 2019-05-13
- Updated version of the package to fix auto publishing script in CI.
## 1.3.3 - 2019-04-05
- Updated dependency `@azure/ms-rest-js`.
## 1.3.2 - 2019-01-28
- Fixed User-Agent tests
## 1.3.1 - 2019-01-07
- Fixed LRO RestErrors parsing
- Added JSON parsing error handling
## 1.3.0 - 2019-01-07
- Removed final GET on POST 202 long running operations
## 1.2.4 - 2018-12-20
- Updated checks in CI
## 1.2.3 - 2018-12-20
- Added checks to run before publishing
## 1.2.2 - 2018-12-19
- More test updates.
## 1.2.1 - 2018-12-17
- Enable test coverage in CI.
## 1.2.0 - 2018-12-04
- Update dependency `@azure/ms-rest-js`.
## 1.1.2 - 2018-11-28
- Fixed event-stream vulnerability
## 1.1.1 - 2018-11-13

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

@ -119,14 +119,16 @@ export abstract class LROPollStrategy {
this._pollState.state = getProvisioningState(result.parsedBody) || "Succeeded";
this._pollState.mostRecentResponse = result;
this._pollState.mostRecentRequest = result.request;
try {
this._pollState.resource = getResponseBody(result);
} catch (error) {
this._pollState.resource = undefined;
const resultStatus: number = result.status;
if (this._pollState.initialResponse.request.method !== "DELETE" || resultStatus < 400 || 499 < resultStatus) {
this._pollState.resource = getResponseBody(result);
}).catch((error) => {
let resultStatus: number | undefined;
if (error.response && error.response.status) {
resultStatus = error.response.status;
if (this._pollState.initialResponse.request.method !== "DELETE" || resultStatus! < 400 || 499 < resultStatus!) {
throw error;
}
} else {
throw error;
}
});
}

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

@ -5,7 +5,7 @@
"email": "azsdkteam@microsoft.com",
"url": "https://github.com/Azure/ms-rest-azure-js"
},
"version": "1.3.5",
"version": "1.3.6",
"description": "Isomorphic Azure client runtime for Typescript/node.js/browser javascript client libraries generated using AutoRest",
"tags": [
"isomorphic",
@ -41,7 +41,7 @@
],
"license": "MIT",
"dependencies": {
"@azure/ms-rest-js": "^1.8.1",
"@azure/ms-rest-js": "^1.8.7",
"tslib": "^1.9.2"
},
"devDependencies": {
@ -54,7 +54,7 @@
"mocha-junit-reporter": "^1.18.0",
"mocha-multi-reporters": "^1.1.7",
"npm-run-all": "^4.1.5",
"nyc": "^13.1.0",
"nyc": "^14.1.1",
"opn-cli": "^4.0.0",
"rollup": "^0.67.3",
"rollup-plugin-node-resolve": "^3.4.0",