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
Fix recursive requester #1430
Fix recursive requester #1430
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -213,6 +213,35 @@ tape('recursive defaults', function(t) { | |
}) | ||
}) | ||
|
||
tape('recursive defaults requester', function(t) { | ||
t.plan(4) | ||
|
||
var defaultsOne = request.defaults({}, function(options, callback) { | ||
var headers = options.headers || {} | ||
headers.foo = 'bar1' | ||
options.headers = headers | ||
|
||
request(options, callback) | ||
}) | ||
, defaultsTwo = defaultsOne.defaults({}, function(options, callback) { | ||
var headers = options.headers || {} | ||
headers.baz = 'bar2' | ||
options.headers = headers | ||
|
||
defaultsOne(options, callback) | ||
}) | ||
|
||
defaultsOne.get(s.url + '/get_recursive1', function (e, r, b) { | ||
t.equal(e, null) | ||
t.equal(b, 'TESTING!') | ||
}) | ||
|
||
defaultsTwo.get(s.url + '/get_recursive2', function (e, r, b) { | ||
t.equal(e, null) | ||
t.equal(b, 'TESTING!') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. t.deepEqual(r.request.headers, {baz: 'bar2', foo: 'bar1'}) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That is being asserted over here: https://github.com/tikotzky/request/blob/fix-recursive-requester/tests/test-defaults.js#L72-L73 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, you have to love that style of writing tests :) Anyway, not your fault. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yup I agree that is pretty disjointed, but thats not from this PR :) |
||
}) | ||
}) | ||
|
||
tape('test custom request handler function', function(t) { | ||
t.plan(2) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is being asserted over here: https://github.com/tikotzky/request/blob/fix-recursive-requester/tests/test-defaults.js#L65