var http = require('http');
var server = http.createServer(function (request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.end("Hello World\n");
});
server.listen(8000);
console.log("Server running at http://127.0.0.1:8000/");
をエンコードされていない要求のスペースを持つサーバーから(52)空の回答私はカールのコマンドを次のように実行:のNode.js:カール:
curl "http://127.0.0.1:8000/"
Hello World
// space is not encoded
curl "http://127.0.0.1:8000/x y"
curl: (52) Empty reply from server
curl "http://127.0.0.1:8000/x"
Hello World
// space is encoded
curl "http://127.0.0.1:8000/x%20y"
Hello World
私はカール52を取得する理由を説明してくださいことはできますか? ?
この場合、私は500を送り返したいと思います。それをしてもいいですか?
残りのノードコードとcurlコマンドラインが必要です。うまくいけばそこにres.sendがあります... – Paul
'app.get( '/ item/id')'は/ item/item1ではない '/ item/id'を意味します – Paul
' -I' curlのオプションを試してみましょう説明。 (私のマシンでは、curlは 'curl http:// google.com/xy'コマンドの2つのリクエストを送信します。最初はGoogle Serverに、もう1つは' y'に)。 – elmigranto