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