Skip to content

Commit

Permalink
Get form URL more reliably (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
aiji42 authored Feb 16, 2021
1 parent d6a90ad commit 17d161e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ async function pushForm(
init: RequestInit = {}
): Promise<Response> {
const fields = new FormData(form);
const url = new URL(form.action, location.origin);
const url = new URL(form.getAttribute('action')!, location.origin);
init.headers = new Headers(init.headers);
if (!init.headers.has('Accept')) {
init.headers.append('Accept', 'text/html,application/xhtml+xml,application/xml');
Expand Down

0 comments on commit 17d161e

Please # to comment.