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

fix: tidy up fetch init with request example #270

Merged
merged 1 commit into from
Apr 16, 2024

Conversation

bsmth
Copy link
Member

@bsmth bsmth commented Apr 15, 2024

Description:

There's a couple of improvements here to get rid of redundant code for the GET request. I believe the method, mode and cache properties are all defaults, so I'm leaving the headers as something a reader is likely to customize with auth, or caching, or something custom.

No real preference on the following:

const req = new Request("flowers.jpg", options);
fetch(req)

vs

const req = new Request("flowers.jpg");
fetch(req, options)

Fixes #151

Related issues and pull requests:

  • TODO content PR

@bsmth bsmth requested a review from sideshowbarker April 15, 2024 12:18
@bsmth bsmth requested a review from a team as a code owner April 15, 2024 12:18
@bsmth bsmth requested review from pepelsbey and removed request for a team April 15, 2024 12:18
@sideshowbarker sideshowbarker merged commit 37db15b into mdn:main Apr 16, 2024
2 checks passed
@bsmth bsmth deleted the 151-fetch-init branch April 16, 2024 16:44
@bsmth
Copy link
Member Author

bsmth commented Apr 16, 2024

Thank you!

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-init-then-request sets Content-Type request header for GET
2 participants