Skip to content

Commit

Permalink
Update redirect.js
Browse files Browse the repository at this point in the history
fix pull 1804 when url like HTTP or HTTPS
  • Loading branch information
FDrag0n authored Mar 21, 2024
1 parent 5229d0c commit ebc4dbf
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions __tests__/response/redirect.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ describe('ctx.redirect(url)', () => {
assert.strictEqual(ctx.status, 302)
})

it('should formatting url before redirect', () => {
const ctx = context()
ctx.redirect('HTTP://google.com\\@apple.com')
assert.strictEqual(ctx.response.header.location, 'http://google.com/@apple.com')
assert.strictEqual(ctx.status, 302)
})

it('should auto fix not encode url', done => {
const app = new Koa()

Expand Down

0 comments on commit ebc4dbf

Please sign in to comment.