balena-request
Advanced tools
Comparing version 11.5.1-move-response-body-error-to-response-body-message-if-there-is-one-063c7fc91ed90c56aea8394a657319241424adc1 to 11.5.1-move-response-body-error-to-response-body-message-if-there-is-one-d7ee386eecbb1438e488c939ddb9d2dbf4ff4caf
@@ -118,4 +118,7 @@ "use strict"; | ||
} | ||
if (response.body.error) { | ||
response.body.message = response.body.error; | ||
if (response.body != null && typeof response.body === 'object') { | ||
const bodyMessageProp = ['message', 'error'].find((prop) => typeof response.body[prop] === 'string'); | ||
if (bodyMessageProp != null) { | ||
return response.body[bodyMessageProp]; | ||
} | ||
} | ||
@@ -122,0 +125,0 @@ return response.body; |
@@ -121,4 +121,9 @@ /* | ||
if (response.body.error) { | ||
response.body.message = response.body.error; | ||
if (response.body != null && typeof response.body === 'object') { | ||
const bodyMessageProp = ['message', 'error'].find( | ||
(prop) => typeof response.body[prop] === 'string', | ||
); | ||
if (bodyMessageProp != null) { | ||
return response.body[bodyMessageProp]; | ||
} | ||
} | ||
@@ -125,0 +130,0 @@ |
{ | ||
"name": "balena-request", | ||
"version": "11.5.1-move-response-body-error-to-response-body-message-if-there-is-one-063c7fc91ed90c56aea8394a657319241424adc1", | ||
"version": "11.5.1-move-response-body-error-to-response-body-message-if-there-is-one-d7ee386eecbb1438e488c939ddb9d2dbf4ff4caf", | ||
"description": "Balena HTTP client", | ||
@@ -67,4 +67,4 @@ "main": "build/request.js", | ||
"versionist": { | ||
"publishedAt": "2022-03-31T12:26:08.600Z" | ||
"publishedAt": "2022-03-31T15:55:40.152Z" | ||
} | ||
} |
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
200406
3985