views:

54

answers:

1

If I do a nc 192.168.2.10 8080 and then GET /test/ I get as expected a JSON response:

Content-Type: text/javascript
Cache-Control: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Content-Length: 74

{ ... a JSON message ...}

However, if I do a POST /test/ I get the following HTML doc as a result:

<head>
<title>Error response</title>
</head>
<body>
<h1>Error response</h1>
<p>Error code 400.
<p>Message: Bad HTTP/0.9 request type ('POST').
<p>Error code explanation: 400 = Bad request syntax or unsupported method.
</body>

Anyone an idea where the problem could be?

+1  A: 

As Nick Johnson said in his comment, try a tool that forms requests properly for you.

Another common source of these sorts of errors is trying to parse a GET request on the server (for arguments or whatever) while you're getting a post request.

Also something that always gets me, but that's a 403, is csrf protection. Remember to turn it off for requests you want to make via curl and similar :)

Swizec Teller
Thanks. That worked. CSRF was the problem.
znq