Skip to content
Myr

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 file

Take it

Added redirect() helpervisionmediabefore adoptionff293e5

lines 1–9why, one step back
1
2describe '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 back
10 it 'should set status to 303'

Added redirect() helpervisionmediabefore adoptionff293e5

line 11why, one step back
11 get('/logout', function(){

Fixed some cookie specsvisionmediabefore adoption7ca5942

line 12why, one step back
12 this.redirect('/')

Added redirect() helpervisionmediabefore adoptionff293e5

line 13why, one step back
13 })

Technically we should redirect with 303visionmediabefore adoption57f8e82

line 14why, one step back
14 get('/logout').status.should.eql 303

Added redirect() helpervisionmediabefore adoptionff293e5

lines 15–16why, one step back
15 get('/logout').headers['location'].should.eql '/'
16 end

Added status code param to Request#header()visionmediabefore adoption2c0ea52

lines 17–19why, one step back
17
18 it 'should allow optional status code'19 get('/logout', function(){

Technically we should redirect with 303visionmediabefore adoption57f8e82

line 20why, one step back
20 this.redirect('/', 304)

Added status code param to Request#header()visionmediabefore adoption2c0ea52

line 21why, one step back
21 })

Technically we should redirect with 303visionmediabefore adoption57f8e82

line 22why, one step back
22 get('/logout').status.should.eql 304

Added status code param to Request#header()visionmediabefore adoption2c0ea52

lines 23–24why, one step back
23 get('/logout').headers['location'].should.eql '/'
24 end

Added redirect() helpervisionmediabefore adoptionff293e5

lines 25–26why, one step back
25 end
26

Fixed redirect helpers due to Request changevisionmediabefore adoption995cde7

line 27why, one step back
27 describe 'redirect("back")'

Added redirect() helpervisionmediabefore adoptionff293e5

lines 28–29why, one step back
28 it 'should check Referrer header'
29 get('/logout', function(){

Fixed redirect helpers due to Request changevisionmediabefore adoption995cde7

line 30why, one step back
30 this.redirect('back')

Added redirect() helpervisionmediabefore adoptionff293e5

lines 31–37why, one step back
31 })
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 back
38 this.redirect('back')

Added redirect() helpervisionmediabefore adoptionff293e5

lines 39–48why, one step back
39 })
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 back
49 this.redirect('home')

Added redirect() helpervisionmediabefore adoptionff293e5

lines 50–56why, one step back
50 })
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 back
57 this.redirect('home')

Added redirect() helpervisionmediabefore adoptionff293e5

lines 58–63why, one step back
58 })
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 back
64 this.redirect('home')

Added redirect() helpervisionmediabefore adoptionff293e5

lines 65–70why, one step back
65 })
66 get('/logout').headers['location'].should.eql '/'67 end68 end69 end70end