fix: redirect works with full path

This commit is contained in:
Sebastien Chopin 2017-06-05 11:24:06 +02:00
parent 5682eef2a5
commit 703b5071d6

View File

@ -36,7 +36,9 @@ export default async (context) => {
}
opts.query = stringify(opts.query)
opts.path = opts.path + (opts.query ? '?' + opts.query : '')
if (opts.path.indexOf('http') !== 0 && ('<%= router.base %>' !== '/' && opts.path.indexOf('<%= router.base %>') !== 0)) {
opts.path = urlJoin('<%= router.base %>', opts.path)
}
context.res.writeHead(opts.status, {
'Location': opts.path
})