Skip to content
Myr

auth.js

This file

Path

test/acceptance/auth.js

42 lines · 1008 bytes · JavaScript

Last changed by

res.location: remove resolving relative urlsJonathan Ongbefore adoptionaac1d52

History of this file

Take it

The walk stopped after 200 commits: lines older than 8942722 point at it.

typoTJ Holowaychukbefore adoption8942722

lines 1–20why, one step back
1var app = require('../../examples/auth/app')
2 , request = require('../support/http');34function redirects(to, fn){5 return function(err, res){6 res.statusCode.should.equal(302)7 res.headers.should.have.property('location').match(to);8 fn()9 }10}1112function getCookie(res) {13 return res.headers['set-cookie'][0].split(';')[0];14}1516describe('auth', function(){17 describe('GET /',function(){18 it('should redirect to /login', function(done){19 request(app)20 .get('/')

res.location: remove resolving relative urlsJonathan Ongbefore adoptionaac1d52

line 21why, one step back
21 .end(redirects(/login$/, done))

typoTJ Holowaychukbefore adoption8942722

lines 22–28why, one step back
22 })
23 })2425 describe('GET /restricted (w/o cookie)',function(){26 it('should redirect to /login', function(done){27 request(app)28 .get('/restricted')

res.location: remove resolving relative urlsJonathan Ongbefore adoptionaac1d52

line 29why, one step back
29 .end(redirects(/login$/,done))

typoTJ Holowaychukbefore adoption8942722

lines 30–38why, one step back
30 })
31 })3233 describe('POST /login', function(){34 it('should fail without proper credentials', function(done){35 request(app)36 .post('/login')37 .type('urlencoded')38 .send('username=not-tj&password=foobar')

res.location: remove resolving relative urlsJonathan Ongbefore adoptionaac1d52

line 39why, one step back
39 .end(redirects(/login$/, done))

typoTJ Holowaychukbefore adoption8942722

lines 40–42why, one step back
40 })
41 })42})