I'm not entirely sure which of your libraries is responsible for this bug, but either case looks like a pretty easy fix. (I'll submit an issue to superagent-mocker as well)
If you want, I can submit a PR to change
if (typeof res !== "undefined" && res.status >= 400) {
to
if (res && res.status >= 400) {
Thanks for taking your time to contribute this very useful library to the OSS community!
I'm using
superagent-mocker
in my unit tests to mock out the super-agent responses, but it seems not to work for non-200 responses.The following code ends up causing an error:
From: https://github.com/KyleAMathews/superagent-bluebird-promise/blob/master/index.js#L66-L67
This is happening when
superagent-mocker
calls that function withres
passed in asnull
rather thanundefined
.https://github.com/A/superagent-mocker/blob/master/index.js#L99-L100
I'm not entirely sure which of your libraries is responsible for this bug, but either case looks like a pretty easy fix. (I'll submit an issue to
superagent-mocker
as well)If you want, I can submit a PR to change
to
Thanks for taking your time to contribute this very useful library to the OSS community!