Skip to content

Commit

Permalink
set headers for both errors and success
Browse files Browse the repository at this point in the history
  • Loading branch information
geekyme committed May 14, 2015
1 parent 3bfeb91 commit b022ae1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions libs/fetcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,14 @@ function parseParamValues (params) {
params: parseParamValues(qs.parse(path.join('&'))),
config: {},
callback: function (err, data, meta) {
if (err) {
res.status(err.statusCode || 400).send(err.message || 'request failed');
return;
}
meta = meta || {};
if (meta.headers) {
res.set(meta.headers);
}
if (err) {
res.status(err.statusCode || 400).send(err.message || 'request failed');
return;
}
res.status(meta.statusCode || 200).json(data);
}
};
Expand Down

0 comments on commit b022ae1

Please sign in to comment.