-
Notifications
You must be signed in to change notification settings - Fork 86
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
Refactor Fetchr Tests #143
Conversation
CLA is valid! |
@redonkulus @mridgway @lingyan this is ready for merge. |
@@ -335,7 +335,14 @@ Fetcher.middleware = function (options) { | |||
} | |||
if (err) { | |||
var errResponse = getErrorResponse(err); | |||
res.status(errResponse.statusCode).json(responseFormatter(req, res, errResponse.output)); | |||
if (req.query && req.query.returnMeta) { |
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.
@Vijar can you explain this part? will this break responseFormatter since output is not passed in directly?
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.
i think we are fine. We are already doing req.query.returnMeta logic branching on line 348 below
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.
Yeah, we were doing this for normal requests but not for error requests so its kind of a bug.
@@ -193,6 +193,10 @@ function io(url, options) { | |||
err = new Error(errMessage); | |||
err.statusCode = status; | |||
err.body = errBody || body; | |||
if (err.body) { |
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.
should we add a deprecate warning in the next release for body
?
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.
I don't see why we can't keep both.
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.
Do we need to update docs to make sure only one is mentioned?
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.
We don't even have docs on handling errors, but I just added some.
👍 |
👍 |
A preview of whats to come.
Fixes #141