Skip to content

feat(fetch): add Request{Init}.duplex and add WPTs - #1681

Merged
mcollina merged 2 commits into
nodejs:mainfrom
KhafraDev:request-wpts
Oct 4, 2022
Merged

feat(fetch): add Request{Init}.duplex and add WPTs#1681
mcollina merged 2 commits into
nodejs:mainfrom
KhafraDev:request-wpts

Conversation

@KhafraDev

Copy link
Copy Markdown
Member
  • Adds Request.duplex and RequestInit.duplex
  • Handles title attributes in META tags.
  • Better expected fails - only fails tests in a file with the test name now. Can also be adjusted to allow skipping entire files, etc. in the future (similar to node core).
  • Most importantly, fixes an issue with using a dynamic import that would cause multiple test(...) functions to fail due to the internal state being set. I could not tell you why this happened.

Both tests that were added to the expected fails could likely be fixed, but I haven't looked into it.

@codecov-commenter

codecov-commenter commented Oct 4, 2022

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 33.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.25%. Comparing base (0964a83) to head (7e77eb5).
⚠️ Report is 1878 commits behind head on main.

Files with missing lines Patch % Lines
lib/fetch/request.js 33.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1681      +/-   ##
==========================================
- Coverage   94.26%   94.25%   -0.02%     
==========================================
  Files          53       53              
  Lines        4884     4887       +3     
==========================================
+ Hits         4604     4606       +2     
- Misses        280      281       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@benmccann

Copy link
Copy Markdown
Contributor

This appears to be causing a regression. We got a report that requests in SvelteKit are now failing: sveltejs/kit#7409. It seems that the duplex field is now required. Someone has proposed always providing it in SvelteKit requests though that does not seem correct to me: sveltejs/kit#7412

@mcollina

Copy link
Copy Markdown
Member

can you open a new issue to track the regression, ideally with a repro?

@KhafraDev

KhafraDev commented Oct 27, 2022

Copy link
Copy Markdown
Member Author

This is part of the spec now. When you have a ReadableStream body, the duplex option is required.

edit: as mentioned in issue, see this: whatwg/fetch@edf07e5#diff-b4827ee42aceaf9dc3e7216f72262d81c32217e9996fb70a657f259e3ac92604R6898-R6899

@KhafraDev
KhafraDev deleted the request-wpts branch October 27, 2022 21:08
@benmccann

Copy link
Copy Markdown
Contributor

Thanks! We'll get SvelteKit updated. I wonder if this should have been a major release as it's a breaking change?

@KhafraDev

Copy link
Copy Markdown
Member Author

Fetch in undici and node core are both considered experimental, so breaking changes should be expected.

See https://github.com/nodejs/undici#undicifetchinput-init-promise and https://nodejs.org/dist/latest-v18.x/docs/api/all.html#all_globals_fetch

It would likely be a good idea to pin undici's version and do manual updates to ensure nothing breaks between versions

@KhafraDev KhafraDev mentioned this pull request Oct 27, 2022
metcoder95 pushed a commit to metcoder95/undici that referenced this pull request Dec 26, 2022
* feat(fetch): add `Request.duplex` and add WPTs

* feat: add remaining applicable tests
crysmags pushed a commit to crysmags/undici that referenced this pull request Feb 27, 2024
* feat(fetch): add `Request.duplex` and add WPTs

* feat: add remaining applicable tests
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.

5 participants