@vonage/server-client
Advanced tools
Comparing version 1.10.1 to 1.10.2
@@ -304,4 +304,9 @@ "use strict"; | ||
} | ||
switch (response.headers.get('content-type')) { | ||
log('Request succeeded'); | ||
// eslint-disable-next-line max-len | ||
const [contentType] = (response.headers.get('content-type') || '').split(';'); | ||
log(`Response content type: ${contentType}`); | ||
switch (contentType) { | ||
case vetch_1.ContentType.FORM_URLENCODED: | ||
log('Decoding form data'); | ||
decoded = response.body | ||
@@ -312,7 +317,10 @@ ? new URLSearchParams(await response.text()) | ||
case vetch_1.ContentType.JSON: | ||
log('Decoding JSON'); | ||
decoded = await response.json(); | ||
break; | ||
default: | ||
log('Decoding text'); | ||
decoded = await response.text(); | ||
} | ||
log('Decoded body', decoded); | ||
const responseHeaders = {}; | ||
@@ -322,3 +330,3 @@ for (const [header, value] of response.headers.entries()) { | ||
} | ||
return { | ||
const result = { | ||
data: decoded, | ||
@@ -331,2 +339,4 @@ config: request, | ||
}; | ||
log('Response', JSON.stringify(result, null, 2)); | ||
return result; | ||
} | ||
@@ -333,0 +343,0 @@ } |
{ | ||
"$schema": "https://json.schemastore.org/package.json", | ||
"name": "@vonage/server-client", | ||
"version": "1.10.1", | ||
"version": "1.10.2", | ||
"description": "The Vonage Server Client provides core functionalities for interacting with Vonage APIs, ensuring a standardized response regardless of the underlying HTTP adapter.", | ||
@@ -6,0 +6,0 @@ "homepage": "https://developer.vonage.com", |
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
54661
1158