小调整
parent
667cd25265
commit
0b03e5f975
|
@ -35,7 +35,7 @@
|
||||||
.____ds-icon____{
|
.____ds-icon____{
|
||||||
position: fixed;
|
position: fixed;
|
||||||
right: 5px;
|
right: 5px;
|
||||||
top: 35%;
|
top: 30%;
|
||||||
z-index: 9999;
|
z-index: 9999;
|
||||||
width: 36px;
|
width: 36px;
|
||||||
height: 36px;
|
height: 36px;
|
||||||
|
|
|
@ -16,10 +16,10 @@ module.exports = {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 替换响应头
|
// 替换响应头
|
||||||
responseReplaceApi.replaceResponseHeaders(headers, res, proxyRes)
|
if (responseReplaceApi.replaceResponseHeaders(headers, res, proxyRes)) {
|
||||||
|
res.setHeader('DS-AfterOPTIONSHeaders-Interceptor', true)
|
||||||
res.setHeader('DS-AfterOPTIONSHeaders-Interceptor', true)
|
log.info('AfterOPTIONSHeaders intercept:', JSON.stringify(headers))
|
||||||
log.info('AfterOPTIONSHeaders intercept:', JSON.stringify(headers))
|
}
|
||||||
},
|
},
|
||||||
is (interceptOpt) {
|
is (interceptOpt) {
|
||||||
return !!interceptOpt.options
|
return !!interceptOpt.options
|
||||||
|
|
|
@ -38,7 +38,7 @@ function replaceResponseHeaders (newHeaders, res, proxyRes) {
|
||||||
// 新增响应头
|
// 新增响应头
|
||||||
for (const headerKey in newHeaders) {
|
for (const headerKey in newHeaders) {
|
||||||
const headerValue = newHeaders[headerKey]
|
const headerValue = newHeaders[headerKey]
|
||||||
if (!headerValue || headerValue === REMOVE) {
|
if (headerValue == null || headerValue === REMOVE) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,6 +46,9 @@ function replaceResponseHeaders (newHeaders, res, proxyRes) {
|
||||||
preHeaders[headerKey] = null // 标记原先响应头为null
|
preHeaders[headerKey] = null // 标记原先响应头为null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (lodash.isEmpty(preHeaders)) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
// 返回原先响应头
|
// 返回原先响应头
|
||||||
return preHeaders
|
return preHeaders
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue