Skip to content

Commit ff25eb4

Browse files
committed
fix: don't render redirect values in anchor ref
1 parent d5081a1 commit ff25eb4

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

__tests__/response/redirect.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ describe('ctx.redirect(url)', () => {
8080
ctx.header.accept = 'text/html'
8181
ctx.redirect(url)
8282
assert.strictEqual(ctx.response.header['content-type'], 'text/html; charset=utf-8')
83-
assert.strictEqual(ctx.body, `Redirecting to <a href="${url}">${url}</a>.`)
83+
assert.strictEqual(ctx.body, `Redirecting to ${url}.`)
8484
})
8585

8686
it('should escape the url', () => {
@@ -90,7 +90,7 @@ describe('ctx.redirect(url)', () => {
9090
ctx.redirect(url)
9191
url = escape(url)
9292
assert.strictEqual(ctx.response.header['content-type'], 'text/html; charset=utf-8')
93-
assert.strictEqual(ctx.body, `Redirecting to <a href="${url}">${url}</a>.`)
93+
assert.strictEqual(ctx.body, `Redirecting to ${url}.`)
9494
})
9595
})
9696

lib/response.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ module.exports = {
309309
if (this.ctx.accepts('html')) {
310310
url = escape(url)
311311
this.type = 'text/html; charset=utf-8'
312-
this.body = `Redirecting to <a href="${url}">${url}</a>.`
312+
this.body = `Redirecting to ${url}.`
313313
return
314314
}
315315

0 commit comments

Comments
 (0)