@osskit/fetch-enhancers
Advanced tools
Comparing version 1.1.3 to 2.0.0
import type { Fetch } from '../types'; | ||
export declare const withHeaders: (fetch: Fetch, headers: Record<string, string>) => Fetch; | ||
export declare const withHeaders: (fetch: Fetch, getHeaders: () => Record<string, string>) => Fetch; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.withHeaders = void 0; | ||
const withHeaders = (fetch, headers) => (url, init) => fetch(url, { | ||
const withHeaders = (fetch, getHeaders) => (url, init) => fetch(url, { | ||
...init, | ||
headers: { | ||
...init?.headers, | ||
...headers, | ||
...getHeaders(), | ||
}, | ||
@@ -10,0 +10,0 @@ }); |
{ | ||
"name": "@osskit/fetch-enhancers", | ||
"version": "1.1.3", | ||
"version": "2.0.0", | ||
"repository": { | ||
@@ -5,0 +5,0 @@ "url": "https://github.com/osskit/fetch-enhancers" |
@@ -6,3 +6,3 @@ import type { RequestInfo, RequestInit } from 'node-fetch'; | ||
export const withHeaders = | ||
(fetch: Fetch, headers: Record<string, string>): Fetch => | ||
(fetch: Fetch, getHeaders: () => Record<string, string>): Fetch => | ||
(url: RequestInfo, init?: RequestInit) => | ||
@@ -13,4 +13,4 @@ fetch(url, { | ||
...init?.headers, | ||
...headers, | ||
...getHeaders(), | ||
}, | ||
}); |
Sorry, the diff of this file is not supported yet
44771