Skip to content
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

Headers send twice in some cases #24

Open
bzuillsmith opened this issue Jun 7, 2016 · 1 comment
Open

Headers send twice in some cases #24

bzuillsmith opened this issue Jun 7, 2016 · 1 comment

Comments

@bzuillsmith
Copy link

bzuillsmith commented Jun 7, 2016

When my model returns nothing for model.getAccessToken because the token doesn't exist in the db, I get two responses. The offending lines are here: https://github.com/oauthjs/express-oauth-server/blob/master/index.js#L49-L52

    .catch(function(e) {
        return handleError(e, req, res); // sends an error response
    })
    .finally(next); // executes after .catch and sends another response

I believe it should be the following, but I am not 100% certain since I'm not very experienced with the flow of promises.

    .tap(next)
    .catch(function(e) {
        return handleError(e, req, res);
    });
@chainlink
Copy link

Pretty sure this is fixed by getting rid of the .finally(next) statements

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants