I want to send http request using node.js. I do:
http = require('http');
var options = {
host: 'www.mainsms.ru',
path: '/api/mainsms/message/send?project='+project+'&sender='+sender+'&message='+message+'&recipients='+from+'&sign='+sign
};
http.get(options, function(res) {
console.log('STATUS: ' + res.statusCode);
console.log('HEADERS: ' + JSON.stringify(res.headers));
}).on('error', function(e) {
console.log('ERROR: ' + e.message);
});
When my path
like this:
/api/mainsms/message/send?project=geoMessage&sender=gis&message=tester_response&recipients=79089145***&sign=2c4135e0f84d2c535846db17b1cec3c6
Its work. But when message
parameter contains any spaces for example tester response
all broke. And in console i see that http use this url:
/api/mainsms/message/send?project=geoMessage&sender=gis&message=tester
How to send spaces. Or i just can't use spaces in url?