Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: align fetch to spec #10203

Merged
merged 12 commits into from
Apr 20, 2021
Merged

Conversation

lucacasonato
Copy link
Member

@lucacasonato lucacasonato commented Apr 15, 2021

This commit aligns the fetch API and the Request / Response
classes belonging to it to the spec. This commit enables all the
relevant fetch WPT tests. Spec compliance is now at around 90%.

Performance is essentially identical now (within 1% of 1.9).

Closes #10002

This commit aligns the `fetch` API and the `Request` / `Response`
classes belonging to it to the spec. This commit enables all the
relevant `fetch` WPT tests. Spec compliance is now at around 90%.

This commit does introduce a approximately 45% performance reduction in
the main `http` loop. The cause of this is a combination of the
`ReadableStream` in the `InnerBody`, the webidl converters, and various
other ineffciencies in the internals. Now that we have test coverage,
these can be individualy addressed in follow up commits.
@lucacasonato lucacasonato marked this pull request as ready for review April 19, 2021 16:25
Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - great work - a leap towards better web compatibility.

op_crates/fetch/20_headers.js Show resolved Hide resolved
*/
function createHttpClient(options) {
return new HttpClient(core.opSync("op_create_http_client", options));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside: we should get rid of Deno.createHttpClient, new Deno.HttpClient should be sufficient.

@lucacasonato lucacasonato merged commit 9e6cd91 into denoland:main Apr 20, 2021
@lucacasonato lucacasonato deleted the body_align_to_spec branch April 20, 2021 12:47
Liamolucko added a commit to Liamolucko/doc_website that referenced this pull request Apr 25, 2021
Fixes denoland#189

I think they were made immutable when aligning `fetch` to spec in denoland/deno#10203
Comment on lines +224 to +225
if (mimeType !== null) {
if (mimeType !== null) {
Copy link

@ghost ghost May 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really late, but the nested if statement's else body is unreachable, you have a duplicate condition.

if (init.headers !== undefined) {
headers = init.headers;
}
headerListFromHeaders(this[_headers]).slice(
Copy link

@ghost ghost May 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Array#slice doesn't it mutate the source, this is dead code. Maybe you wanted Array#splice?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fetch with Request init with body of FormData is broken
3 participants