(opts: DevProxyOptions)
| 53 | * All env validation belongs to the caller (vite.config.ts). |
| 54 | */ |
| 55 | export function createDevProxy(opts: DevProxyOptions): ProxyOptions { |
| 56 | return { |
| 57 | target: opts.target, |
| 58 | changeOrigin: true, |
| 59 | ws: true, |
| 60 | configure: (proxy) => { |
| 61 | registerDevProxyHandlers(proxy, opts) |
| 62 | } |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | export function registerDevProxyHandlers(proxy: DevProxyHookRegistrar, opts: DevProxyOptions) { |
| 67 | proxy.on('proxyReq', (proxyReq, req, res) => { |
no test coverage detected