Pages: [1]   Go Down
Author Topic: [help] HTTP Error 400. The request has an invalid header name  (Read 1035 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
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.

Code:
/* 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");
        wifly.println("key=123456");
    } else {
        Serial.println("Failed to connect");
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 96
Posts: 4702
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.
Logged

Pages: [1]   Go Up
Jump to: