parent
7713bffdc0
commit
041a4b16a1
@ -1,23 +0,0 @@
|
||||
const contextPath = '/____ds_script____/'
|
||||
const monkey = require('../../monkey')
|
||||
module.exports = {
|
||||
requestIntercept (context, req, res, ssl, next) {
|
||||
const { rOptions, log } = context
|
||||
const urlPath = rOptions.path
|
||||
const filename = urlPath.replace(contextPath, '')
|
||||
|
||||
const script = monkey.get()[filename]
|
||||
|
||||
log.info('ds_script', filename, script != null)
|
||||
res.writeHead(200)
|
||||
res.write(script.script)
|
||||
res.end()
|
||||
return true
|
||||
},
|
||||
is (rOptions) {
|
||||
if (rOptions.path.indexOf(contextPath) !== 0) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
const _ = require('lodash')
|
||||
module.exports = (middlewares) => {
|
||||
if (middlewares) {
|
||||
if (Object.prototype.toString.call(middlewares) !== '[object Array]') {
|
||||
throw new TypeError('middlewares must be a array')
|
||||
}
|
||||
}
|
||||
//
|
||||
// const sslConnectInterceptors = []
|
||||
// const requestInterceptors = []
|
||||
// const responseInterceptors = []
|
||||
|
||||
_.each(middlewares, (m) => {
|
||||
if (m.buildIn === false || m.buildIn === 'false') {
|
||||
|
||||
} else {
|
||||
// m.name
|
||||
}
|
||||
})
|
||||
}
|
Loading…
Reference in new issue