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

HTTP status codes? (take 2) #16

Open
zsszatmari opened this issue Nov 5, 2015 · 0 comments
Open

HTTP status codes? (take 2) #16

zsszatmari opened this issue Nov 5, 2015 · 0 comments

Comments

@zsszatmari
Copy link

Hi!

I would expect the following to return a http status code:

const express = require('express');
const app = express();
const Q = require('q');

app.use(require('express-promise')());

app.get('/index.html', function(req, res){

    res.send(Q(new Error(401)));
});

const port = Number(process.env.PORT || 3000);
app.listen(port, function () {
    console.log("Listening on " + port);
});

Instead I get '{}' as response body and 200 OK as status code.
In fact, I see no way I see no way to return http status code as promise result. Is there an easy way I've overlooked?
Thank You!

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

1 participant