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

server.arg() is broken for POST requests on 2.4.0? #4426

Closed
cwalger opened this issue Feb 23, 2018 · 1 comment
Closed

server.arg() is broken for POST requests on 2.4.0? #4426

cwalger opened this issue Feb 23, 2018 · 1 comment

Comments

@cwalger
Copy link

cwalger commented Feb 23, 2018

in 2.3.0 this was working as expected:

in javascript, i am using createXmlHttpObject(), xmlHttp.open('POST', abc.com, true), then xmlHttp.send('item='+value), where value is a string to identify which button was pushed

in 2.3.0, (server.arg(0)=="off") would return true,

but in 2.4.0, only (server.arg(0)=="item=off") returns true,

Thanks!

@cwalger cwalger changed the title server.args() & server.arg() are broken for POST requests on 2.4.0? server.arg() is broken for POST requests on 2.4.0? Feb 23, 2018
@cwalger
Copy link
Author

cwalger commented Feb 23, 2018

Sorry, I think I have found an answer in #3791:

"In my ajax, I did not have any "Content-Type" Set. This leads to the ESP 2.4.0-rc2 spitting the POST Data as "Plain", and unparsed"

Solution looks to be adding:
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

@cwalger cwalger closed this as completed Feb 23, 2018
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

No branches or pull requests

1 participant