Permalink
Browse files

fixed persistent connections

  • Loading branch information...
1 parent 1443ab6 commit 324e5af54efda9728fa8f94bf28ad0a5ef0161a3 @AlgoTrader committed Feb 20, 2013
Showing with 3 additions and 2 deletions.
  1. +3 −2 lib/betfair_invocation.js
View
5 lib/betfair_invocation.js
@@ -64,6 +64,7 @@ BetfairInvocation.prototype.execute = function(callback) {
self.callback = callback || function() {
};
+ self.jsonRequestBody = JSON.stringify(self.request);
var parsedUrl = url.parse(this.service);
var httpOptions = {
host : parsedUrl.hostname,
@@ -75,7 +76,8 @@ BetfairInvocation.prototype.execute = function(callback) {
headers : {
'X-Application' : exports.applicationKey,
'X-Authentication' :'"'+self.sessionKey+'"',
- "Content-Type" : 'application/json',
+ 'Content-Type' : 'application/json',
+ 'Content-Length' : self.jsonRequestBody.length,
'Connection' : 'keep-alive'
}
};
@@ -107,7 +109,6 @@ BetfairInvocation.prototype.execute = function(callback) {
var req = https.request(httpOptions, responseCallback);
// send json data
- self.jsonRequestBody = JSON.stringify(self.request);
req.write(self.jsonRequestBody);
req.end();
}

0 comments on commit 324e5af

Please sign in to comment.