| 42 | @return An instance of proxy, could be closed by calling `instance.close()` |
| 43 | */ |
| 44 | function proxyServerWithRule(rule, overrideConfig) { |
| 45 | const AnyProxy = util.freshRequire('../proxy.js'); |
| 46 | |
| 47 | const options = Object.assign({}, DEFAULT_OPTIONS, overrideConfig); |
| 48 | options.rule = rule; |
| 49 | |
| 50 | const instance = new AnyProxy.ProxyServer(options); |
| 51 | instance.on('error', e => { |
| 52 | console.log('server instance error', e); |
| 53 | }); |
| 54 | instance.start(); |
| 55 | |
| 56 | return instance; |
| 57 | } |
| 58 | |
| 59 | function proxyServerWithoutHttpsIntercept(rule) { |
| 60 | const AnyProxy = util.freshRequire('../proxy.js'); |