Advertisement
Multivit4min

Untitled

Apr 16th, 2016
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         function lengthInUtf8Bytes(str) {
  2.             var m = encodeURIComponent(str).match(/%[89ABab]/g);
  3.             return str.length + (m ? m.length : 0);
  4.         }
  5.  
  6.         var data = {"somekey": "somevalue"};
  7.  
  8.         sinusbot.http({
  9.             'method': 'POST',
  10.             'url': url,
  11.             'body': data,
  12.             'headers': {
  13.                 'Content-Type': 'application/json; charset=utf-8',
  14.                 'Content-Length': lengthInUtf8Bytes(data)
  15.             },
  16.             'timeout': 4000
  17.         }, function(error, response) {
  18.             return {'error': error, 'response': response.data};
  19.         });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement