parent
2bbecc5a25
commit
38c79587e2
|
@ -11,8 +11,8 @@ export function createCors() {
|
|||
let opts = this.get('cors')
|
||||
|
||||
if (opts.enabled) {
|
||||
let origin = req.header('origin') || req.header('referer') || ''
|
||||
let headers = req.header('access-control-request-headers')
|
||||
let origin = req.headers['origin'] || req.headers['referer'] || ''
|
||||
let headers = req.headers['access-control-request-headers']
|
||||
let { hostname, host, protocol } = parse(origin)
|
||||
|
||||
if (opts.origin.length && hostname) {
|
||||
|
@ -24,7 +24,7 @@ export function createCors() {
|
|||
}
|
||||
}
|
||||
if (pass === false) {
|
||||
return res.end('')
|
||||
return (res.body = null)
|
||||
}
|
||||
}
|
||||
if (opts.credentials) {
|
||||
|
@ -43,7 +43,7 @@ export function createCors() {
|
|||
}
|
||||
|
||||
if (req.method === 'OPTIONS') {
|
||||
return res.end('')
|
||||
return (res.body = null)
|
||||
}
|
||||
}
|
||||
next()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@gm5/core",
|
||||
"version": "2.0.1",
|
||||
"version": "2.0.2",
|
||||
"type": "module",
|
||||
"description": "Five.js, 一个轻量级的nodejs mvc框架 旨在简单易用, 5分钟即可上手",
|
||||
"author": "yutent <yutent.io@gmail.com>",
|
||||
|
|
Loading…
Reference in New Issue