@platformatic/client
Advanced tools
Comparing version 1.14.0 to 1.14.1
29
index.js
@@ -139,2 +139,3 @@ 'use strict' | ||
const canHaveBody = method === 'POST' || method === 'PUT' || method === 'PATCH' || method === 'OPTIONS' | ||
const pathParams = methodMeta.parameters?.filter(p => p.in === 'path') || [] | ||
@@ -217,12 +218,15 @@ const queryParams = methodMeta.parameters?.filter(p => p.in === 'query') || [] | ||
try { | ||
res = await request(urlToCall, { | ||
const requestOptions = { | ||
method, | ||
headers: { | ||
...headers, | ||
...telemetryHeaders, | ||
'content-type': 'application/json; charset=utf-8' | ||
...telemetryHeaders | ||
}, | ||
body: JSON.stringify(body), | ||
throwOnError | ||
}) | ||
} | ||
if (canHaveBody) { | ||
requestOptions.headers['content-type'] = 'application/json; charset=utf-8' | ||
requestOptions.body = JSON.stringify(body) | ||
} | ||
res = await request(urlToCall, requestOptions) | ||
let responseBody | ||
@@ -242,10 +246,2 @@ const contentType = sanitizeContentType(res.headers['content-type']) || 'application/json' | ||
} | ||
if (fullResponse) { | ||
return { | ||
statusCode: res.statusCode, | ||
headers: res.headers, | ||
body: responseBody | ||
} | ||
} | ||
if (validateResponse) { | ||
@@ -273,2 +269,9 @@ try { | ||
} | ||
if (fullResponse) { | ||
return { | ||
statusCode: res.statusCode, | ||
headers: res.headers, | ||
body: responseBody | ||
} | ||
} | ||
return responseBody | ||
@@ -275,0 +278,0 @@ } catch (err) { |
{ | ||
"name": "@platformatic/client", | ||
"version": "1.14.0", | ||
"version": "1.14.1", | ||
"description": "A client for all platformatic backends", | ||
@@ -27,3 +27,3 @@ "main": "index.js", | ||
"typescript": "^5.2.2", | ||
"@platformatic/telemetry": "1.14.0" | ||
"@platformatic/telemetry": "1.14.1" | ||
}, | ||
@@ -30,0 +30,0 @@ "dependencies": { |
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
32113
547