diff --git a/lib/node/index.js b/lib/node/index.js index 6dce9153c..0cf7dc3c8 100644 --- a/lib/node/index.js +++ b/lib/node/index.js @@ -550,6 +550,17 @@ Request.prototype.cert = function(cert){ return this; }; +/** + * Set tcp no delay option + * + * @param noDelay + * @returns {*} + */ +Request.prototype.setNoDelay = function(noDelay){ + this._noDelay = noDelay === true; + return this; +}; + /** * Return an http[s] request. * @@ -609,6 +620,12 @@ Request.prototype.request = function(){ // request var req = this.req = mod.request(options); + + // set tcp no delay + if (this._noDelay === true && req.setNoDelay) { + req.setNoDelay(true); + } + if ('HEAD' != options.method) { req.setHeader('Accept-Encoding', 'gzip, deflate'); }