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

Working with APIs: Clarify default 'cors' mode behavior in CORS section #28733

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Maddily
Copy link
Contributor

@Maddily Maddily commented Sep 2, 2024

Because

I wanted to mention the default behavior when sending cross-origin requests using fetch.

This PR

  • Mentions that, in case the request being sent is cross-origin, mode: 'cors'` is set by default.
  • Adds that explicitly specifying mode: 'cors' in the options is good for clarity.

Issue

Closes #XXXXX

Additional Information

N/A

Pull Request Requirements

  • I have thoroughly read and understand The Odin Project curriculum contributing guide
  • The title of this PR follows the location of change: brief description of change format, e.g. Intro to HTML and CSS lesson: Fix link text
  • The Because section summarizes the reason for this PR
  • The This PR section has a bullet point list describing the changes in this PR
  • If this PR addresses an open issue, it is linked in the Issue section
  • If any lesson files are included in this PR, they have been previewed with the Markdown preview tool to ensure it is formatted correctly
  • If any lesson files are included in this PR, they follow the Layout Style Guide

@github-actions github-actions bot added the Content: JavaScript Involves the JavaScript course label Sep 2, 2024
@wise-king-sullyman wise-king-sullyman requested review from a team and thatblindgeye and removed request for a team September 3, 2024 14:11
@MaoShizhong
Copy link
Contributor

We can actually probably just remove the { mode: 'cors' } bits entirely (from this lesson and a few other lessons in the curriculum) as that's the default mode for fetch. So the CORS section introducing that to "solve a problem" is redundant because there is no problem when omitted.

If you can put this on hold for a bit, I'm discussing with the team regarding some other CORS material because there might be an additional thing we need to do on top of removing the mode options references. I'll get back to you once we've discussed that through.

@Maddily
Copy link
Contributor Author

Maddily commented Sep 5, 2024

That makes sense. I'll put this on hold for now and wait for your update after the team discussion.

@Mclilzee
Copy link
Contributor

Mclilzee commented Sep 5, 2024

@MaoShizhong There was an Issue + PR I opened regarding this in the past. Maybe it is worth looking into why it was closed and not merged Check #23232

@Maddily Maddily closed this Sep 29, 2024
@Maddily Maddily deleted the patch-1 branch September 29, 2024 14:28
@Maddily Maddily restored the patch-1 branch September 29, 2024 14:29
@Maddily Maddily reopened this Sep 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content: JavaScript Involves the JavaScript course
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants