Skip to content

Commit

Permalink
Revert "fix(extensions/fetch): Add Origin header to outgoing requests…
Browse files Browse the repository at this point in the history
… for fetch (#11557)" (#11565)

This reverts commit f87aa44.
  • Loading branch information
bartlomieju authored Aug 2, 2021
1 parent 3a2e944 commit 505d253
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
4 changes: 0 additions & 4 deletions cli/tests/unit/fetch_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,6 @@ unitTest(
"POST /blah HTTP/1.1\r\n",
"hello: World\r\n",
"foo: Bar\r\n",
"origin: http://js-unit-tests\r\n",
"accept: */*\r\n",
`user-agent: Deno/${Deno.version.deno}\r\n`,
"accept-encoding: gzip, br\r\n",
Expand Down Expand Up @@ -713,7 +712,6 @@ unitTest(
"hello: World\r\n",
"foo: Bar\r\n",
"content-type: text/plain;charset=UTF-8\r\n",
"origin: http://js-unit-tests\r\n",
"accept: */*\r\n",
`user-agent: Deno/${Deno.version.deno}\r\n`,
"accept-encoding: gzip, br\r\n",
Expand Down Expand Up @@ -751,7 +749,6 @@ unitTest(
"POST /blah HTTP/1.1\r\n",
"hello: World\r\n",
"foo: Bar\r\n",
"origin: http://js-unit-tests\r\n",
"accept: */*\r\n",
`user-agent: Deno/${Deno.version.deno}\r\n`,
"accept-encoding: gzip, br\r\n",
Expand Down Expand Up @@ -1131,7 +1128,6 @@ unitTest(
"POST /blah HTTP/1.1\r\n",
"hello: World\r\n",
"foo: Bar\r\n",
"origin: http://js-unit-tests\r\n",
"accept: */*\r\n",
`user-agent: Deno/${Deno.version.deno}\r\n`,
"accept-encoding: gzip, br\r\n",
Expand Down
13 changes: 0 additions & 13 deletions extensions/fetch/26_fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@
TypeError,
Uint8Array,
} = window.__bootstrap.primordials;
const { getLocationHref } = window.__bootstrap.location;
const { URL } = window.__bootstrap.url;

const REQUEST_BODY_HEADER_NAMES = [
"content-encoding",
Expand Down Expand Up @@ -431,17 +429,6 @@
}
requestObject.signal[abortSignal.add](onabort);

const baseURL = getLocationHref();
if (
baseURL &&
(requestObject.method !== "GET" && requestObject.method !== "HEAD")
) {
ArrayPrototypePush(request.headerList, [
"origin",
new URL(baseURL).origin,
]);
}

if (!requestObject.headers.has("accept")) {
ArrayPrototypePush(request.headerList, ["accept", "*/*"]);
}
Expand Down
21 changes: 20 additions & 1 deletion tools/wpt/expectation.json
Original file line number Diff line number Diff line change
Expand Up @@ -2646,7 +2646,26 @@
"request-headers-nonascii.any.html": true,
"request-headers.any.html": [
"Fetch with PUT without body",
"Fetch with POST without body"
"Fetch with PUT with body",
"Fetch with POST without body",
"Fetch with POST with text body",
"Fetch with POST with FormData body",
"Fetch with POST with URLSearchParams body",
"Fetch with POST with Blob body",
"Fetch with POST with ArrayBuffer body",
"Fetch with POST with Uint8Array body",
"Fetch with POST with Int8Array body",
"Fetch with POST with Float32Array body",
"Fetch with POST with Float64Array body",
"Fetch with POST with DataView body",
"Fetch with POST with Blob body with mime type",
"Fetch with Chicken",
"Fetch with Chicken with body",
"Fetch with POST and mode \"same-origin\" needs an Origin header",
"Fetch with POST and mode \"no-cors\" needs an Origin header",
"Fetch with PUT and mode \"same-origin\" needs an Origin header",
"Fetch with TacO and mode \"same-origin\" needs an Origin header",
"Fetch with TacO and mode \"cors\" needs an Origin header"
],
"text-utf8.any.html": true,
"accept-header.any.html": [
Expand Down

0 comments on commit 505d253

Please sign in to comment.