Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node v0.9.x compatibility #399

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion index.js
Expand Up @@ -108,7 +108,6 @@ function Request (options) {
} }
} }
} }
options = copy(options)


this.init(options) this.init(options)
} }
Expand Down Expand Up @@ -572,6 +571,8 @@ Request.prototype.start = function () {
delete reqOptions.auth delete reqOptions.auth


self.req = self.httpModule.request(reqOptions, function (response) { self.req = self.httpModule.request(reqOptions, function (response) {
response.resume();

if (response.connection.listeners('error').indexOf(self._parserErrorHandler) === -1) { if (response.connection.listeners('error').indexOf(self._parserErrorHandler) === -1) {
response.connection.once('error', self._parserErrorHandler) response.connection.once('error', self._parserErrorHandler)
} }
Expand Down Expand Up @@ -1140,6 +1141,8 @@ function request (uri, options, callback) {
options = uri options = uri
} }


options = copy(options)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason to move options copy down?


if (callback) options.callback = callback if (callback) options.callback = callback
var r = new Request(options) var r = new Request(options)
return r return r
Expand Down
3 changes: 2 additions & 1 deletion tests/test-params.js
Expand Up @@ -82,7 +82,8 @@ s.listen(s.port, function () {
} }
counter = counter - 1; counter = counter - 1;
if (counter === 0) { if (counter === 0) {
console.log(Object.keys(tests).length+" tests passed.") assert.notEqual(typeof test.callback, 'function')
console.log(1 + Object.keys(tests).length+" tests passed.")
s.close() s.close()
} }
}) })
Expand Down