-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
chore: align fetch to spec #10203
Conversation
dafb154
to
78fd950
Compare
7f088a4
to
2695bc3
Compare
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.
2695bc3
to
34d629f
Compare
Improves throughput from 32k to 40k req/s on M1.
Lazily create the inner request / response body stream for static body. Improvement from 40k -> 44k req/s.
There was a problem hiding this 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.
*/ | ||
function createHttpClient(options) { | ||
return new HttpClient(core.opSync("op_create_http_client", options)); | ||
} |
There was a problem hiding this comment.
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.
Fixes denoland#189 I think they were made immutable when aligning `fetch` to spec in denoland/deno#10203
if (mimeType !== null) { | ||
if (mimeType !== null) { |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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
?
This commit aligns the
fetch
API and theRequest
/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