get-it
Version:
Generic HTTP request library for node, browsers and workers
16 lines (13 loc) • 393 B
text/typescript
import type {Middleware} from 'get-it'
/** @public */
export function headers(_headers: any, opts: any = {}) {
return {
processOptions: (options) => {
const existing = options.headers || {}
options.headers = opts.override
? Object.assign({}, existing, _headers)
: Object.assign({}, _headers, existing)
return options
},
} satisfies Middleware
}