function lengthInUtf8Bytes(str) {
var m = encodeURIComponent(str).match(/%[89ABab]/g);
return str.length + (m ? m.length : 0);
}
var data = {"somekey": "somevalue"};
sinusbot.http({
'method': 'POST',
'url': url,
'body': data,
'headers': {
'Content-Type': 'application/json; charset=utf-8',
'Content-Length': lengthInUtf8Bytes(data)
},
'timeout': 4000
}, function(error, response) {
return {'error': error, 'response': response.data};
});
Comments