Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

res.location back test #3293

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
res.location back test
A split of #3291 of just the tests.

Fixes #3292
  • Loading branch information
WORMSS authored Apr 27, 2017
commit 7676c4cd46c5d75b5e4cdbd3b484551760ac32b9
27 changes: 27 additions & 0 deletions test/res.location.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,32 @@ describe('res', function(){
.expect('Location', 'https://google.com?q=%A710')
.expect(200, done)
})

it('should set the header to "/" on back', function (done) {
var app = express()

app.use(function (req, res) {
res.location('back').end()
})

request(app)
.get('/')
.expect('Location', '/')
.expect(200, done)
})

it('should set the header to "next" on back', function (done) {
var app = express()

app.use(function (req, res) {
res.location('back').end()
})

request(app)
.get('/')
.set('Referrer', '/next')
.expect('Location', '/next')
.expect(200, done)
})
})
})