http module, semicolon in POSTs badly encoded
Gloorf opened this issue ยท 0 comments
If you try to do a POST request with semicolon inside the data, the post data after the semicolon will be ignored. Sample code :
var http = require('http');
var receiver = self;
http.request( {
url: 'https://dpaste.de/api/',
method: 'POST',
params: {'expires': 3600,
'format': 'url',
'content': 'data;ignored data'}
}, function(code, body) {
echo(receiver, body);
});
The generated paste will not contain the ";ignored data" part.
The problem arise because we use encodeURI to generate the parameters string, see here in paramsToString, where we should be using encodeURIComponent (at least based on my understanding on when to use it) - which does solves the problem.