Skip to content

Commit

Permalink
fix(http): support "headers" in addition to "header"
Browse files Browse the repository at this point in the history
"headers" is the forward-looking value.
  • Loading branch information
chrisdickinson committed May 22, 2024
1 parent d5cdb2e commit 21e11a7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/background-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ class HttpContext {
return 0n;
}

const { header, url: rawUrl, method: m } = req.json();
const { headers, header, url: rawUrl, method: m } = req.json();
const method = m ?? 'GET';
const url = new URL(rawUrl);

Expand All @@ -447,7 +447,7 @@ class HttpContext {
const body = bodyaddr === 0n || method === 'GET' || method === 'HEAD' ? null : callContext.read(bodyaddr)?.bytes();
const fetch = this.fetch;
const response = await fetch(rawUrl, {
headers: header,
headers: headers || header,
method,
...(body ? { body: body.slice() } : {}),
});
Expand Down

0 comments on commit 21e11a7

Please sign in to comment.