Skip to content

Commit

Permalink
Changed handleResponse to use res.redirect instead of manually set lo…
Browse files Browse the repository at this point in the history
…cation header
  • Loading branch information
Michael Salinger committed Nov 11, 2016
1 parent ade1ca4 commit 660f586
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,18 @@ ExpressOAuthServer.prototype.token = function(options) {
/**
* Handle response.
*/

var handleResponse = function(req, res, response) {
res.set(response.headers);
res.status(response.status).send(response.body);

if (response.status === 302) {
var location = response.headers.location;
delete response.headers.location;
res.set(response.headers);
res.redirect(location);
}
else {
res.set(response.headers);
res.status(response.status).send(response.body);
}
};

/**
Expand Down

0 comments on commit 660f586

Please sign in to comment.