Go Down

Topic: [help] HTTP Error 400. The request has an invalid header name (Read 1 time) 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

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131