Skip to content

Commit 0433247

Browse files
committed
Somewhat match the native headers
1 parent e5821e5 commit 0433247

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ async function pushForm(
44
): Promise<Response> {
55
const fields = new FormData(form);
66
const url = new URL(form.action, location.origin);
7-
const headers = new Headers(init.headers);
8-
if (!headers.has('Accept')) {
9-
headers.append('Accept', 'text/html,application/xhtml+xml,application/xml');
7+
init.headers = new Headers(init.headers);
8+
if (!init.headers.has('Accept')) {
9+
init.headers.append('Accept', 'text/html,application/xhtml+xml,application/xml');
1010
}
1111

1212
init.method = form.method;
@@ -18,7 +18,7 @@ async function pushForm(
1818
}
1919
} else {
2020
init.body = fields;
21-
headers.append('Cache-Control', 'max-age=0');
21+
init.headers.append('Cache-Control', 'max-age=0');
2222
}
2323

2424
return (pushForm.fetch ?? fetch)(url.toString(), init);

0 commit comments

Comments
 (0)