Skip to content

Commit a50ccc0

Browse files
author
Rohan Jain
committed
Add Content-Length header
Nginx requires this header to be present in a POST request.
1 parent ac6119e commit a50ccc0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/utils.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,16 @@ var alertBrowserStack = function alertBrowserStack (subject, content, params, fn
5252
params.subject = subject;
5353
params.content = content;
5454

55+
var body = querystring.stringify(params);
5556
var options = {
5657
hostname: urlObject.hostname,
5758
port: urlObject.port,
5859
path: urlObject.path,
5960
method: 'POST',
60-
auth: config.username + ":" + config.key
61+
auth: config.username + ":" + config.key,
62+
headers: {
63+
'Content-Length': body.length
64+
}
6165
};
6266

6367
var callback = function (res) {
@@ -89,7 +93,7 @@ var alertBrowserStack = function alertBrowserStack (subject, content, params, fn
8993
};
9094

9195
var request = http.request(options, callback);
92-
request.write(querystring.stringify(params));
96+
request.write(body);
9397
request.end();
9498

9599
return request;

0 commit comments

Comments
 (0)