express - Node.js: curl: (52) Empty reply from server with space in request not encoded -
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 @ http://127.0.0.1:8000/");
i executed following curl commands:
curl "http://127.0.0.1:8000/" hello world // space not encoded curl "http://127.0.0.1:8000/x y" curl: (52) empty reply server curl "http://127.0.0.1:8000/x" hello world // space encoded curl "http://127.0.0.1:8000/x%20y" hello world
can please explain why curl 52???
in case, want send 500 back. can that?
even missing res.send
looks issue route. meant.
app.get('/item/:id', function(...) { .. })
note :
before id
. creates variable can accessed on req.params.id.
Comments
Post a Comment