Skip to content

Commit 7676c4c

Browse files
authored
res.location back test
A split of expressjs#3291 of just the tests. Fixes expressjs#3292
1 parent 1b6e700 commit 7676c4c

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

test/res.location.js

+27
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,32 @@ describe('res', function(){
4242
.expect('Location', 'https://google.com?q=%A710')
4343
.expect(200, done)
4444
})
45+
46+
it('should set the header to "/" on back', function (done) {
47+
var app = express()
48+
49+
app.use(function (req, res) {
50+
res.location('back').end()
51+
})
52+
53+
request(app)
54+
.get('/')
55+
.expect('Location', '/')
56+
.expect(200, done)
57+
})
58+
59+
it('should set the header to "next" on back', function (done) {
60+
var app = express()
61+
62+
app.use(function (req, res) {
63+
res.location('back').end()
64+
})
65+
66+
request(app)
67+
.get('/')
68+
.set('Referrer', '/next')
69+
.expect('Location', '/next')
70+
.expect(200, done)
71+
})
4572
})
4673
})

0 commit comments

Comments
 (0)