mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-16 21:56:25 -05:00
use /-/whoami endpoint instead of /whoami
Allows to get rid of referer magic, so it's a nice change to have. See this issue for details: https://github.com/npm/npm-registry-client/issues/88
This commit is contained in:
parent
400288bb69
commit
bad7aee4ec
2 changed files with 11 additions and 0 deletions
|
@ -41,6 +41,9 @@ module.exports = function(config, auth, storage) {
|
|||
next('route')
|
||||
}
|
||||
})
|
||||
app.get('/-/whoami', function(req, res, next) {
|
||||
next({ username: req.remote_user.name })
|
||||
})
|
||||
|
||||
// TODO: anonymous user?
|
||||
app.get('/:package/:version?', can('access'), function(req, res, next) {
|
||||
|
|
|
@ -129,5 +129,13 @@ module.exports = function() {
|
|||
cb()
|
||||
})
|
||||
})
|
||||
|
||||
it('who am I?', function(cb) {
|
||||
server.request({uri:'/-/whoami'}, function(err, res, body) {
|
||||
assert.equal(res.statusCode, 200)
|
||||
assert.equal(body.username, 'test')
|
||||
cb()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue