Friday 5 May 2017

URL encoding with NodeJS

I try to use get request by going on a URL like http://localhost:8080/user/toto-lolo in order to get informations of this user but I've got an error on the console :

The character encoding of the plain text document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the file needs to be declared in the transfer protocol or file needs to use a byte order mark as an encoding signature.

My request :

app.get("/user/:name", function(req,res){
    testDb.find({name : req.params.name}, function(err,doc){
        res.send(doc);
        res.statusCode = 200;
    })
});



via Tewan

No comments:

Post a Comment