What is the expected behavior?
The property 'method' should be available on a request from superagent, similar to here:
https://runkit.com/mrijke/superagent-with-method-on-request
What is the actual behavior?
The 'method' property is undefined
Possible solution
Copy the value from the 'method' property, if available (i.e. the request came from superagent)
How to reproduce the issue
https://runkit.com/mrijke/nock-superagent-undefined-method
Does the bug have a test case?
No, but the superagent specific testcase can be extended, e.g.
test('superagent works', t => {
const responseText = 'Yay superagent!'
const headers = { 'Content-Type': 'text/plain' }
nock('http://example.test')
.get('/somepath')
.reply(200, responseText, headers)
superagent.get('http://example.test/somepath').end(function(err, res) {
t.equal(res.text, responseText)
t.equal(res.req.method, "get") // <-- added assert here
t.end()
})
})
Versions
| Software |
Version(s) |
| Nock |
10.0.6 |
| Node |
10.15.3 |
What is the expected behavior?
The property 'method' should be available on a request from
superagent, similar to here:https://runkit.com/mrijke/superagent-with-method-on-request
What is the actual behavior?
The 'method' property is undefined
Possible solution
Copy the value from the 'method' property, if available (i.e. the request came from
superagent)How to reproduce the issue
https://runkit.com/mrijke/nock-superagent-undefined-method
Does the bug have a test case?
No, but the superagent specific testcase can be extended, e.g.
Versions