postman-request
Advanced tools
Comparing version 2.86.1-postman.1 to 2.86.1-postman.2-beta.1
@@ -10,3 +10,3 @@ { | ||
], | ||
"version": "2.86.1-postman.1", | ||
"version": "2.86.1-postman.2-beta.1", | ||
"repository": { | ||
@@ -13,0 +13,0 @@ "type": "git", |
@@ -136,2 +136,3 @@ 'use strict' | ||
Request.debug = process.env.NODE_DEBUG && /\brequest\b/.test(process.env.NODE_DEBUG) | ||
function debug () { | ||
@@ -142,2 +143,3 @@ if (Request.debug) { | ||
} | ||
Request.prototype.debug = debug | ||
@@ -155,2 +157,22 @@ | ||
// additional postman feature starts | ||
// bind default events sent via options | ||
if (options.bindOn) { | ||
Object.keys(options.bindOn).forEach(function (eventName) { | ||
!Array.isArray(options.bindOn[eventName]) && (options.bindOn[eventName] = [options.bindOn[eventName]]) | ||
options.bindOn[eventName].forEach(function (listener) { | ||
self.on(eventName, listener) | ||
}) | ||
}) | ||
} | ||
if (options.once) { | ||
Object.keys(options.once).forEach(function (eventName) { | ||
!Array.isArray(options.bindOnce[eventName]) && (options.bindOnce[eventName] = [options.bindOnce[eventName]]) | ||
options.bindOnce[eventName].forEach(function (listener) { | ||
self.once(eventName, listener) | ||
}) | ||
}) | ||
} | ||
// additional postman feature ends | ||
// Delete headers with value undefined since they break | ||
@@ -442,2 +464,3 @@ // ClientRequest.OutgoingMessage.setHeader in node 0.12 | ||
} | ||
if (self.body && !isstream(self.body)) { | ||
@@ -520,5 +543,5 @@ setContentLength() | ||
// self.on('pipe', function () { | ||
// console.error('You have already piped to this stream. Pipeing twice is likely to break the request.') | ||
// }) | ||
// self.on('pipe', function () { | ||
// console.error('You have already piped to this stream. Pipeing twice is likely to break the request.') | ||
// }) | ||
}) | ||
@@ -743,2 +766,5 @@ | ||
// postman: emit start event | ||
self.emit('start') | ||
self._started = true | ||
@@ -896,3 +922,3 @@ self.method = self.method || 'GET' | ||
self.agent.addRequestNoreuse) { | ||
self.agent = { addRequest: self.agent.addRequestNoreuse.bind(self.agent) } | ||
self.agent = {addRequest: self.agent.addRequestNoreuse.bind(self.agent)} | ||
self.start() | ||
@@ -974,3 +1000,3 @@ self.req.end() | ||
self.strictSSL && (!response.hasOwnProperty('socket') || | ||
!response.socket.authorized)) { | ||
!response.socket.authorized)) { | ||
debug('strict ssl error', self.uri.href) | ||
@@ -1133,3 +1159,3 @@ var sslErr = response.hasOwnProperty('socket') ? response.socket.authorizationError : self.uri.href + ' does not support SSL' | ||
var self = this | ||
debug("reading response's body") | ||
debug('reading response\'s body') | ||
var buffers = [] | ||
@@ -1136,0 +1162,0 @@ var bufferLength = 0 |
209581
2655