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

void PsychicRequest::loadParams() method HTTP_DELETE and HTTP_PUT sent in body not being processed. #212

Open
WeGoWireless opened this issue Feb 18, 2025 · 1 comment

Comments

@WeGoWireless
Copy link

WeGoWireless commented Feb 18, 2025

PsychicRequst.cpp void PsychicRequest::loadParams() line 287 checks for HTTP_POST body _addParams but HTTP_DELETE and HTTP_PUT also send params in request->body(). More knowledgeable person may have better advice to avoid breaking something.

One solution that worked for me is:
PsychicRequst.cpp void PsychicRequest::loadParams() line 287

if ((this->method() == HTTP_POST || this->method() == HTTP_PUT || this->method() == HTTP_DELETE) &&
(this->contentType().startsWith("application/x-www-form-urlencoded") || this->contentType().startsWith("text/plain")))

I don't think this covers every scenario. "multipart/form-data" is another issue. ASYNCWebServer has more checking. Keeping it basic here I think. I will check jeremypoulter/ArduinoMongoose next. I did test "text/plain", HTTP_PUT and HTTP_DELETE. Would hope it doesn't break something else. Ideas welcome!

Thanks!

@WeGoWireless
Copy link
Author

Testing the below solution and so far working:
if ((this->method() != HTTP_GET) && (this->contentType().startsWith("application/x-www-form-urlencoded") || this->contentType().startsWith("text/plain")))

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