Multivit4min icon

Untitled

Multivit4min | PRO | 04/16/16 12:04:21 PM UTC | 0 ⭐ | 419 👁️ | Never ⏰ | []
JavaScript |

630 B

|

None

|

0 👍

/

0 👎

        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