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

Can't use POST method for a route with express #15

Closed
nicolas-brousse opened this issue Mar 22, 2012 · 8 comments
Closed

Can't use POST method for a route with express #15

nicolas-brousse opened this issue Mar 22, 2012 · 8 comments

Comments

@nicolas-brousse
Copy link

If I use POST method for a route, URL always send 401 Unauthorized.

var app = require('express').createServer();

app.post('/request', function(req, res) {
    expressAuth.apply(req, res, function(username) {
        res.contentType('json');
        res.send(JSON.stringify({'msg':'ok'}));
    });
});

And it is the same, when I have a query in URL like http://url.com/request?var=value

var app = require('express').createServer();

app.get('/request', function(req, res) {
    expressAuth.apply(req, res, function(username) {
        res.contentType('json');
        res.send(JSON.stringify({'msg':'ok'}));
    });
});

So I want a secure route to send data, and I don't arrive to do this.

@gevorg
Copy link
Owner

gevorg commented Mar 25, 2012

Hi Nicolas,

Post works perfectly, that is how basic auth works. Try to use express sample with curl client: "curl --user Shi:many222 -d "param1=value1&param2=value2" http://127.0.0.1:1337/"

@gevorg gevorg closed this as completed Mar 25, 2012
@gevorg
Copy link
Owner

gevorg commented Mar 25, 2012

No problem with get request with params as well.

Gevorg.

@nicolas-brousse
Copy link
Author

Yes,

But sorry I forgot to say that I use Digest Auth and not Basic Auth

@gevorg gevorg reopened this Mar 25, 2012
@gevorg
Copy link
Owner

gevorg commented Mar 25, 2012

ok, let me recheck :)

@gevorg
Copy link
Owner

gevorg commented Mar 25, 2012

Hi Nicolas,

I reproduced issue and will try to fix it.

Thanks.

@nicolas-brousse
Copy link
Author

Thanks very much !

@gevorg
Copy link
Owner

gevorg commented Mar 27, 2012

Issue is fixed and published to NPM.

Thanks for reporting ;)

@gevorg gevorg closed this as completed Mar 27, 2012
@nicolas-brousse
Copy link
Author

Thanks for your update =)

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