Files
cypress/packages/proxy/lib/network-proxy.ts
Zach Bloomquist 15c3e95429 Improve error experience when visiting outside of Cypress-launched browser (#6435)
* force websockets transport

* wip: ensure ws connections take place thru a known socket

* clean up yesterday's work

* remove dead code (request is undefined)

* update websocket tests

* add websocket tests

* update socket + server specs

* add token auth for file_server

* Fix cy.visit file_server

* restrict non-proxied URLs, serve error on runner URL non-proxied

* add e2e test for server splash page

* fix types

* use clientRoute, fix tests

* only run 6_non_proxied in electron

* use browser.path

* improve empty options type

* add ws assertions in e2e tests

* fix server_spec

* refactor socket whitelisting logic

* update server_spec

* respond to PR feedback

- added tests for non-clientRoute redirecting to clientRoute when not behind proxy
- cleaned up comments
- cleaned up logic in server.coffee
- moved error html to own file
- added unit test for socket whitelist + fixed removal bug
2020-02-14 16:21:36 -05:00

28 lines
434 B
TypeScript

import { Http } from './http'
export class NetworkProxy {
http: Http
constructor (opts: {
config: any
getRemoteState: () => any
getFileServerToken: () => string
middleware?: any
request: any
}) {
this.http = new Http(opts)
}
handleHttpRequest (req, res) {
this.http.handle(req, res)
}
setHttpBuffer (buffer) {
this.http.setBuffer(buffer)
}
reset () {
this.http.reset()
}
}