Skip to content

Added note on triggered preflight when setting $.ajax contentType #488

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

Closed
wants to merge 4 commits into from

Conversation

ksokhan
Copy link
Contributor

@ksokhan ksokhan commented May 6, 2014

When you define a specific contentType in an $.ajax request, jquery will send a CORS preflight OPTIONS request. This is somewhat "hidden" behaviour that can often cause headaches unless its documented.

ksokhan added 2 commits May 6, 2014 11:51
When you define a specific contentType in an $.ajax request, jquery will send a CORS preflight OPTIONS request. This is somewhat "hidden" behaviour that can often cause headaches unless its documented.
@mgol
Copy link
Member

mgol commented May 6, 2014

Thanks for taking the time to contribute to the jQuery project! Can you sign the CLA?

Two issues:

  1. Technically, this is not jQuery that triggers the OPTIONS request but the browser itself.
  2. It's triggered only for cross-domain requests, not all of them.

@ksokhan
Copy link
Contributor Author

ksokhan commented May 6, 2014

@mzgol

  • Signed CLA
  • The wording I used simply says that a request is triggered, not specifically by jQuery. Despite this, end users of the documentation should still be told about any "leaky abstractions" that happen.
  • Yes! Good point. Updated to say that this only occurs on cross-domain requests.

@ksokhan
Copy link
Contributor Author

ksokhan commented May 28, 2014

Is there anything more I can do to move this along?

@dmethvin
Copy link
Member

Sometimes it takes a while for someone to review everything, sorry.

On this particular change, the use of passive voice in "will trigger a CORS preflight OPTIONS request" may lead someone to think that jQuery is doing this. That is what @mzgol was saying, since this is jQuery documentation the assumed actor is jQuery. With that in mind, I think the wording needs to make it clear that CORS requires this and the browser is doing it. Does that make sense? I do agree that preflight OPTIONS take many people by surprise though, so no objection from me regarding some sort of notice here.

@ksokhan
Copy link
Contributor Author

ksokhan commented May 30, 2014

@dmethvin thanks for breaking it down a bit more. I have revised the copy to be more clear on that point.

Didn't mean to sound impatient; I just wanted to help move things along.

@kswedberg kswedberg closed this in 517615b Jul 5, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

4 participants