小调整。
parent
5941c25ba9
commit
bdcff4a1cc
|
@ -92,9 +92,9 @@ module.exports = {
|
||||||
// 如果未手动配置需要缓存,则不允许使用缓存
|
// 如果未手动配置需要缓存,则不允许使用缓存
|
||||||
const maxAge = cacheReq.getMaxAge(interceptOpt)
|
const maxAge = cacheReq.getMaxAge(interceptOpt)
|
||||||
if (maxAge == null || maxAge <= 0) {
|
if (maxAge == null || maxAge <= 0) {
|
||||||
replaceHeaders['cache-control'] = '[remove]'
|
replaceHeaders['cache-control'] = REMOVE
|
||||||
replaceHeaders['last-modified'] = '[remove]'
|
replaceHeaders['last-modified'] = REMOVE
|
||||||
replaceHeaders.expires = '[remove]'
|
replaceHeaders.expires = REMOVE
|
||||||
}
|
}
|
||||||
|
|
||||||
actions += `${actions ? ',' : ''}download:${filename}`
|
actions += `${actions ? ',' : ''}download:${filename}`
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
const lodash = require('lodash')
|
const lodash = require('lodash')
|
||||||
const log = require('./util.log.server')
|
const log = require('./util.log.server')
|
||||||
|
const mergeApi = require('@docmirror/dev-sidecar/src/merge')
|
||||||
|
|
||||||
function isMatched (url, regexp) {
|
function isMatched (url, regexp) {
|
||||||
if (regexp === '.*' || regexp === '*' || regexp === 'true' || regexp === true) {
|
if (regexp === '.*' || regexp === '*' || regexp === 'true' || regexp === true) {
|
||||||
|
@ -113,16 +114,6 @@ function merge (oldObj, newObj) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
function deleteNullItems (target) {
|
|
||||||
lodash.forEach(target, (item, key) => {
|
|
||||||
if (item == null || item === '[delete]') {
|
|
||||||
delete target[key]
|
|
||||||
}
|
|
||||||
if (lodash.isObject(item)) {
|
|
||||||
deleteNullItems(item)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function matchHostnameAll (hostMap, hostname, action) {
|
function matchHostnameAll (hostMap, hostname, action) {
|
||||||
// log.debug('matchHostname-all:', action, hostMap)
|
// log.debug('matchHostname-all:', action, hostMap)
|
||||||
|
@ -178,7 +169,7 @@ function matchHostnameAll (hostMap, hostname, action) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!lodash.isEmpty(values)) {
|
if (!lodash.isEmpty(values)) {
|
||||||
deleteNullItems(values)
|
mergeApi.deleteNullItems(values)
|
||||||
log.info(`matchHostname-all: ${action}: '${hostname}':`, JSON.stringify(values))
|
log.info(`matchHostname-all: ${action}: '${hostname}':`, JSON.stringify(values))
|
||||||
return values
|
return values
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue