Comparing version 5.1.1 to 5.1.2
@@ -22,3 +22,2 @@ "use strict"; | ||
this.config = options; | ||
this.response.data = translateData(options.responseType, response.data); | ||
this.code = response.status.toString(); | ||
@@ -28,16 +27,2 @@ } | ||
exports.GaxiosError = GaxiosError; | ||
function translateData(responseType, data) { | ||
switch (responseType) { | ||
case 'stream': | ||
return data; | ||
case 'json': | ||
return JSON.parse(JSON.stringify(data)); | ||
case 'arraybuffer': | ||
return JSON.parse(Buffer.from(data).toString('utf8')); | ||
case 'blob': | ||
return JSON.parse(data.text()); | ||
default: | ||
return JSON.parse(data.text()); | ||
} | ||
} | ||
//# sourceMappingURL=common.js.map |
@@ -130,12 +130,2 @@ "use strict"; | ||
if (!opts.validateStatus(translatedResponse.status)) { | ||
if (opts.responseType === 'stream') { | ||
let response = ''; | ||
await new Promise(resolve => { | ||
translatedResponse.data.on('data', chunk => { | ||
response += chunk; | ||
}); | ||
translatedResponse.data.on('end', resolve); | ||
}); | ||
translatedResponse.data = response; | ||
} | ||
throw new common_1.GaxiosError(`Request failed with status code ${translatedResponse.status}`, opts, translatedResponse); | ||
@@ -142,0 +132,0 @@ } |
# Changelog | ||
## [5.1.2](https://github.com/googleapis/gaxios/compare/v5.1.1...v5.1.2) (2023-06-25) | ||
### Bug Fixes | ||
* Revert changes to error handling due to downstream breakage ([#544](https://github.com/googleapis/gaxios/issues/544)) ([64fbf07](https://github.com/googleapis/gaxios/commit/64fbf07f3697f40b75a9e7dbe8bff7f6243a9e12)) | ||
## [5.1.1](https://github.com/googleapis/gaxios/compare/v5.1.0...v5.1.1) (2023-06-23) | ||
@@ -4,0 +11,0 @@ |
{ | ||
"name": "gaxios", | ||
"version": "5.1.1", | ||
"version": "5.1.2", | ||
"description": "A simple common HTTP client specifically for Google APIs and services.", | ||
@@ -5,0 +5,0 @@ "main": "build/src/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
71403
714