Handle post back from a client

I've been implementing a WiFiNINA web server on a Nano IOT 33 using this sample " WiFiNINA/AP_SimpleWebServer.ino at master · arduino-libraries/WiFiNINA · GitHub" and have no issues with GET requests, but haven't found any examples that would explain a POST request, in particular how to get the body content/payload.

There are lots of examples om how to make a post request to a different server, but nothing that I have been able to find on handling the POST request including it's body content/payload.

If someone could let me know how to do this or show me an example that would be great.

Thanks

post your code using code tags

in a nutshell you should not discard the header to just focus on the line after the header's blank separation line.

Thanks for that and can see the body post data. So after the new line, read the next and stop I'm assuming on a /r?

can you share a sample output of the request (header and whatever comes after)?
then we'll know where to extract the data from

Thanks for it, I actually just found a solution. Instead of looking for the double new line as per the current sample code, I'm looking for a new line and then client.peek() returning a -1 value. Quite possible I could just use client.peek() returning a -1 value as the flag, but need to check what other cases it might return -1, only new to WiFi and Arduino.

-1 means nothing left to read

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.