Go Down

Topic: Server Response to a POST request from a Client (Read 1 time) previous topic - next topic


I have an Uno Wifi Rev 2 set up as a  web server.  I have a simple web page that contains a button with a POST method.  When I run my code I get a "ERR_CONNECTION_RESET" error from Chrome.  If return the entire web page things work fine.  I don't think I should have to do this.

If I run with a GET method things run fine.  Below are two code spinets one for POST and one for GET.  My full code is attached below.

A sane person may ask why not just use the GET and be done with it.  From my reading on the two methods the post seems to fit better with what I want to do namely issue a stop command from a web page to stop the process I'm running on the Arduino.

//POST code that fails
        if (currentLine.endsWith("POST /stop")) {

          Serial.println("Got it");
            // HTTP headers always start with a response code (e.g. HTTP/1.1 200 OK)
            // and a content-type so the client knows what's coming, then a blank line:
            client.println("HTTP/1.1 200 OK");

            // The HTTP response ends with another blank line:

//GET code that works
       if (currentLine.endsWith("GET /stop")) {

          Serial.println("Got it");



Problem fixed.  Problem with my HTML.  Can't figure out how to delete post.

Go Up