Permalink
Browse files

Use Buffer.byteLength instead of string length for Content-Length header

This prevents Content-Length mismatches when sending multi-byte characters.

See https://groups.google.com/forum/?fromgroups=#!topic/nodejs/LAxACfj5_KI.
  • Loading branch information...
1 parent c6c960e commit bfcfbbd573ce1eb0deadbb3c473270d83b913263 @joshisa joshisa committed Dec 23, 2013
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/monitor.js
View
@@ -182,7 +182,7 @@ Monitor.prototype.createPing = function(error, check, timestamp, time, details,
options.method = 'POST';
options.headers = {
'Content-Type': 'application/x-www-form-urlencoded',
- 'Content-Length': postData.length
+ 'Content-Length': Buffer.byteLength(postData)
};
this.applyApiHttpOptions(options);
var self = this;

0 comments on commit bfcfbbd

Please sign in to comment.