rest-api-kit
Advanced tools
Comparing version 0.0.36 to 0.0.37
@@ -67,4 +67,4 @@ type MethodType = "GET" | "POST" | "PUT" | "PATCH" | "DELETE"; | ||
declare function createRequest(url?: string, method?: MethodType, body?: {}, headers?: {}, rest?: Partial<Omit<RequestType, "headers" | "url" | "method" | "body">>): Promise<any>; | ||
declare function makeRequest(payload: string | Partial<RequestType>): Promise<any> | undefined; | ||
declare function createRequest(url?: string, headers?: {}, method?: MethodType, body?: {}, rest?: Partial<Omit<RequestType, "headers" | "url" | "method" | "body">>): Promise<any>; | ||
declare function makeRequest(payload: string | Partial<RequestType>, headers: Headers): Promise<any> | undefined; | ||
@@ -71,0 +71,0 @@ /** |
@@ -44,3 +44,3 @@ "use strict"; | ||
// src/apifunctions.ts | ||
async function createRequest(url = "", method, body = {}, headers = {}, rest) { | ||
async function createRequest(url = "", headers = {}, method, body = {}, rest) { | ||
try { | ||
@@ -69,3 +69,3 @@ let params = { | ||
} | ||
function makeRequest(payload) { | ||
function makeRequest(payload, headers) { | ||
if (!payload) { | ||
@@ -75,6 +75,6 @@ return; | ||
if (typeof payload === "string") { | ||
return createRequest(payload); | ||
return createRequest(payload, headers); | ||
} | ||
const { url, method, body, headers, ...rest } = payload; | ||
return createRequest(url, method, body, headers, rest); | ||
const { url, method, body, ...rest } = payload; | ||
return createRequest(url, headers, method, body, rest); | ||
} | ||
@@ -337,5 +337,5 @@ | ||
body: params.bodyAsQueryParams ? {} : body, | ||
headers, | ||
method: params.method | ||
} | ||
}, | ||
headers | ||
); | ||
@@ -342,0 +342,0 @@ if (params.saveToCache) { |
{ | ||
"name": "rest-api-kit", | ||
"version": "0.0.36", | ||
"version": "0.0.37", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "module": "dist/index.mjs", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
32916