fix: 修复 mock 接口 cors headers 返回错误

This commit is contained in:
2betop 2022-04-25 16:45:39 +08:00
parent 195048b43b
commit e08c4873fc

View File

@ -54,7 +54,7 @@ function mockResponse(event, context, callback) {
function createHeaders(headers) {
let referer = '';
if (/^(https?\:\/\/[^:\/]+(?:\:\d+)?\/)/i.test(headers['Referer'])) {
if (/^(https?\:\/\/[^:\/]+(?:\:\d+)?\/)/i.test(headers['referer'])) {
referer = RegExp.$1.replace(/\/$/, '');
}