Go Down

Topic: [help] HTTP Error 400. The request has an invalid header name (Read 2770 times) previous topic - next topic


The headers I am using look like below with the last print line being my "data." I am using the WiFlyHQ library. Not sure what I am doing wrong. Probably something stupid and obvious like always. Any help would be appreciated.

Code: [Select]
/* Send the request */
wifly.println("POST /API/testapi.ashx HTTP/1.1");
wifly.println("Host: mywebsite.com");
        wifly.println("Content-Length: 40");
        wifly.println("X-Target-URI: http://sharesay.us");
        wifly.println("Content-Type: application/x-www-form-urlencoded; charset=UTF-8");
        wifly.println("Connection: Keep-Alive");
    } else {
        Serial.println("Failed to connect");


First of all your header isn't terminated (a blank line terminates the header fields). Then the content of your header fields should be correct. If you tell the server that your payload is 40 bytes but actually you're sending 10 bytes it might be not so happy about that.

Go Up