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
Axios 0.21.1 post request ignores false as a request payload #3549
Comments
Looks like this was introduced in #1487. Should the check be |
I had the same issue. In addition to false (boolean), it repros for the number 0 as well. Unsurprising given the changelist ChickenProp pointed to. |
Hi @anagligoric Are you intending to send a post request with the body purely being a boolean value? Thanks |
I can't speak for them, but that's what I was intending to do when I encountered this bug. |
We have the same problem with sending |
Hi All, Ok well, this is not exactly how the docs show Axios should be used as the second param of the post operation within the documentation shows an object must be passed. I know this worked previously but completely un-intentionally and Axios matures I am certain we will not be adding back what was pretty much an oversight. Thanks |
Hey @jasonsaayman , sending values as a body of a request seems legit JSON object - https://tools.ietf.org/html/rfc7158#page-5. The same goes for the standard of REST API. At this moment, we are basically stuck on 0.19.0 version where this is "supported" |
Clarification: the docs actually say that
(This is easy to miss, and the typescript type is more general than that, but it is there.) So calling JSON.stringify yourself on bools and numbers should work. |
Even this works as it is cast to string basically and passes the |
I tend to agree with @GLObus303, since I also think that valid JSON objects should be accepted as payload, but if you still decide to keep that "new" behavior of only allowing objects and string, then please can someone adapt the typing of those post/patch/put methods to incorporate this decision? |
Hi Ok cool well yeah, I agree with you that the JSON spec is pretty clear as for the REST API standard well that is maybe a bit less unclear since it is pretty difficult to lock down official documentation. However, that being said I believe that we should allow a JSON body and in saying that we would need to support the spec for a valid JSON object. So I will start work on fixing this issue, I will probably start on this tomorrow. Thanks |
could this be related to #3526 ? |
When is 0.22.0 being released with this fix by chance? |
Hi I would like to get 0.22 completed by mid to end April, there are some other changes that will need to be in there including new build tools for axios etc. Thanks |
Thank you @jasonsaayman! |
should not this issue be closed??? |
It's been 3 years now. Will there be a fix anytime soon? |
Describe the bug
After updating Axios from 0.19.2 to 0.21.1, post request ignores false (boolean value) when passed as a request payload, but true is sent properly
To Reproduce
Expected behavior
The false value shouldn't be ignored.
Environment
Additional context/Screenshots
Converting false boolean value to string works properly, but some servers cannot deserialize string "false" to boolean false value [e.g .NET Core].
The text was updated successfully, but these errors were encountered: