🔧 override headers with custom headers
This commit is contained in:
parent
75c5e0b5a1
commit
e150f7d26f
1 changed files with 5 additions and 1 deletions
|
|
@ -59,10 +59,14 @@ export function fetchwithRequestOptions(
|
|||
: new HttpProxyAgent(proxy, agentOptions)
|
||||
: new protocol.Agent(agentOptions);
|
||||
|
||||
const headers: { [key: string]: string } = requestOptions?.headers || {};
|
||||
let headers: { [key: string]: string } = {};
|
||||
for (const [key, value] of Object.entries(init?.headers || {})) {
|
||||
headers[key] = value as string;
|
||||
}
|
||||
headers = {
|
||||
...headers,
|
||||
...requestOptions?.headers,
|
||||
};
|
||||
|
||||
// Replace localhost with 127.0.0.1
|
||||
if (url.hostname === "localhost") {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue