-
Notifications
You must be signed in to change notification settings - Fork 96
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
options.json === false #141
Comments
oops. |
I was also considering just changing it to
but that would break backward compatibility for POSTing to APIs that respond with JSON while accepting empty body (undefined) or null This feels urgent to me, so I'm not going to wait too long before releasing it. |
Seems if (options.json) or more explicitly if (options.json === true) and removing backwards compatibility of passing a body to |
Sounds good. Wanna do the honors and suggest that in the v3 roadmap discussion? :D |
fix #141 - json set to false should mean no json
Per the recent
json
option behaviour changes, where:json: true
causesbody
to be serialized withJSON.stringify
; and by extension,true
is not a valid json value (anymore)What should the behaviour for
json: false
be? By the logic of the second point (which I agree with),false
should also not be a valid value.However, passing
json: false
* currently results in "false" being sent, instead of disabling json behaviour.* Passing
false
may be a desired thing to do ifjson: true
is default behaviour for 99% of requests (for example, by usingajaxConfig
in ampersand-sync), but you want to disable json behaviour for one request.I propose that L161 is changed from:
to
To disable json behaviour when
json: false
is passed into the options.This raises questions of what to do about
null
andundefined
, but I think this is a good starting point, asfalse
is very explicit and unambiguous.Let me know your thoughts, and I can submit a PR!
The text was updated successfully, but these errors were encountered: