Comparing version 1.0.5 to 1.0.6
@@ -33,3 +33,12 @@ "use strict"; | ||
const buildFetchOptions = (method, headers, body) => { | ||
const options = { method: method.toUpperCase(), headers }; | ||
const modifiedHeaders = { ...headers }; | ||
// Set Content-Type header if body is a string | ||
if (body && typeof body === 'string') { | ||
modifiedHeaders['Content-Type'] = 'application/json'; | ||
} | ||
const options = { | ||
method: method.toUpperCase(), | ||
headers: modifiedHeaders, | ||
}; | ||
// Add the body only if it's a POST or PUT request | ||
if (body && ['POST', 'PUT'].includes(method.toUpperCase())) { | ||
@@ -36,0 +45,0 @@ options.body = body; |
{ | ||
"name": "outport", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "types": "dist/index.d.ts", |
@@ -34,3 +34,3 @@ const testApi = async (data: { | ||
const errorResp: { success: boolean, time: string, errorMessage?: string } = { success: false, time: convertMillSecToReadable(Date.now() - startTime) } | ||
if(typeof error == 'string'){ | ||
if (typeof error == 'string') { | ||
errorResp.errorMessage = error | ||
@@ -51,6 +51,19 @@ } | ||
): RequestInit => { | ||
const options: RequestInit = { method: method.toUpperCase(), headers }; | ||
const modifiedHeaders = { ...headers }; | ||
// Set Content-Type header if body is a string | ||
if (body && typeof body === 'string') { | ||
modifiedHeaders['Content-Type'] = 'application/json'; | ||
} | ||
const options: RequestInit = { | ||
method: method.toUpperCase(), | ||
headers: modifiedHeaders, | ||
}; | ||
// Add the body only if it's a POST or PUT request | ||
if (body && ['POST', 'PUT'].includes(method.toUpperCase())) { | ||
options.body = body; | ||
} | ||
return options; | ||
@@ -70,11 +83,11 @@ }; | ||
if (minutes) { | ||
if(time) time+=", " | ||
if (time) time += ", " | ||
time += `${minutes}m` | ||
} | ||
if (seconds) { | ||
if(time) time+=", " | ||
if (time) time += ", " | ||
time += `${seconds}s` | ||
} | ||
if (milliseconds) { | ||
if(time) time+=", " | ||
if (time) time += ", " | ||
time += `${milliseconds}ms` | ||
@@ -81,0 +94,0 @@ } |
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
214577
4203