Merge pull request #119 from amarzavery/lro

Handle 404 properly in the final GET of an LRO DELETE operation
This commit is contained in:
Amar Zavery 2019-06-03 16:30:53 -07:00 коммит произвёл GitHub
Родитель 74c3955b0a 06e0c03e99
Коммит c353d93b43
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 53 добавлений и 10 удалений

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,8 +41,8 @@
],
"license": "MIT",
"dependencies": {
"@azure/ms-rest-js": "^1.8.1",
"tslib": "^1.9.2"
"@azure/ms-rest-js": "^1.8.8",
"tslib": "^1.9.3"
},
"devDependencies": {
"@ts-common/azure-js-dev-tools": "^0.6.0",
@ -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",