如果我做了nc 192.168.2.10 8080
,然后GET /test/
我得到预期的JSON响应:的Django /应用程序引擎:让HTML错误响应做HTTP POST请求时(HTTP GET作品)
Content-Type: text/javascript
Cache-Control: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Content-Length: 74
{ ... a JSON message ...}
但是,如果我做一个POST /test/
我得到以下HTML文档的结果:
<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>
任何一个知道那里的问题可能是什么?
听起来好像你没有正确地形成对服务器的请求。使用wget或curl,以便您可以测试它,而不依赖于您对HTTP语法的了解。 – 2010-09-14 17:09:54