spec.plugins.redirect.js
This file
Path
spec/spec.plugins.redirect.js
70 lines · 1.8 KiB · JavaScript
Last changed by
Technically we should redirect with 303visionmediabefore adoption57f8e82
History of this fileTake it
Added redirect() helpervisionmediabefore adoptionff293e5
lines 1–9why, one step back12describe 'Express'3 before_each4 reset()5 use(require('express/plugins/redirect').Redirect)6 end7 8 describe 'Redirect'9 describe 'redirect()'Technically we should redirect with 303visionmediabefore adoption57f8e82
line 10why, one step back10 it 'should set status to 303'Added redirect() helpervisionmediabefore adoptionff293e5
line 11why, one step back11 get('/logout', function(){Fixed some cookie specsvisionmediabefore adoption7ca5942
line 12why, one step back12 this.redirect('/')Added redirect() helpervisionmediabefore adoptionff293e5
line 13why, one step back13 })Technically we should redirect with 303visionmediabefore adoption57f8e82
line 14why, one step back14 get('/logout').status.should.eql 303Added redirect() helpervisionmediabefore adoptionff293e5
lines 15–16why, one step back15 get('/logout').headers['location'].should.eql '/'16 endAdded status code param to Request#header()visionmediabefore adoption2c0ea52
lines 17–19why, one step back17 18 it 'should allow optional status code'19 get('/logout', function(){Technically we should redirect with 303visionmediabefore adoption57f8e82
line 20why, one step back20 this.redirect('/', 304)Added status code param to Request#header()visionmediabefore adoption2c0ea52
line 21why, one step back21 })Technically we should redirect with 303visionmediabefore adoption57f8e82
line 22why, one step back22 get('/logout').status.should.eql 304Added status code param to Request#header()visionmediabefore adoption2c0ea52
lines 23–24why, one step back23 get('/logout').headers['location'].should.eql '/'24 endAdded redirect() helpervisionmediabefore adoptionff293e5
lines 25–26why, one step back25 end26 Fixed redirect helpers due to Request changevisionmediabefore adoption995cde7
line 27why, one step back27 describe 'redirect("back")'Added redirect() helpervisionmediabefore adoptionff293e5
lines 28–29why, one step back28 it 'should check Referrer header'29 get('/logout', function(){Fixed redirect helpers due to Request changevisionmediabefore adoption995cde7
line 30why, one step back30 this.redirect('back')Added redirect() helpervisionmediabefore adoptionff293e5
lines 31–37why, one step back31 })32 var response = get('/logout', { headers: { referrer: '/login' }})33 response.headers['location'].should.eql '/login'34 end35 36 it 'should check referer header'37 get('/logout', function(){Fixed redirect helpers due to Request changevisionmediabefore adoption995cde7
line 38why, one step back38 this.redirect('back')Added redirect() helpervisionmediabefore adoptionff293e5
lines 39–48why, one step back39 })40 var response = get('/logout', { headers: { referer: '/login' }})41 response.headers['location'].should.eql '/login'42 end43 end44 45 describe 'redirect(home)'46 it 'should check set("home")'47 set('home', '/login')48 get('/logout', function(){Fixed redirect helpers due to Request changevisionmediabefore adoption995cde7
line 49why, one step back49 this.redirect('home')Added redirect() helpervisionmediabefore adoptionff293e5
lines 50–56why, one step back50 })51 get('/logout').headers['location'].should.eql '/login'52 end53 54 it 'should check set("basepath")'55 set('basepath', '/web/')56 get('/logout', function(){Fixed redirect helpers due to Request changevisionmediabefore adoption995cde7
line 57why, one step back57 this.redirect('home')Added redirect() helpervisionmediabefore adoptionff293e5
lines 58–63why, one step back58 })59 get('/logout').headers['location'].should.eql '/web/'60 end61 62 it 'should default to "/"'63 get('/logout', function(){Fixed redirect helpers due to Request changevisionmediabefore adoption995cde7
line 64why, one step back64 this.redirect('home')Added redirect() helpervisionmediabefore adoptionff293e5
lines 65–70why, one step back65 })66 get('/logout').headers['location'].should.eql '/'67 end68 end69 end70end