Pages: [1]   Go Down
Author Topic: [help] HTTP Error 400. The request has an invalid header name  (Read 1447 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

/* Send the request */
wifly.println("POST /API/testapi.ashx HTTP/1.1");
        wifly.println("Content-Length: 40");
        wifly.println("Content-Type: application/x-www-form-urlencoded; charset=UTF-8");
        wifly.println("Connection: Keep-Alive");
    } else {
        Serial.println("Failed to connect");

Offline Offline
Faraday Member
Karma: 112
Posts: 5291
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Pages: [1]   Go Up
Jump to: