mirror of
https://github.com/cypress-io/cypress.git
synced 2026-02-04 22:30:00 -06:00
* renames * Refactor proxy into own package, implement middleware pattern don't need these mocha opts anymore fix test no more zunder READMEs fix test * pass request by reference * fix cors path * Move replace_stream to proxy, concat-stream util in network * Pin dependency versions * Revert addDefaultPort behavior * Add READMEs for proxy, network * Update README.md * eslint --fix * set to null not undefined * use delete and bump node types * import cors from package now * parse-domain@2.3.4 * proxy package needs common-tags * move pumpify dep * load through where it's needed, remove unused passthru_stream * remove unneeded getbuffer call Co-authored-by: Gleb Bahmutov <gleb.bahmutov@gmail.com>
proxy
This package contains the code for Cypress's HTTP interception proxy.
HTTP interception
./lib/http contains the code that intercepts HTTP requests. The bulk of the proxy's behavior is in three files:
request-middleware.tscontains code that manipulates HTTP requests from the browserresponse-middleware.tscontains code that manipulates HTTP responses to the browsererror-middleware.tshandles errors that occur in the request/response cycle
Installing Dependencies
npm i
Building
Note: you should not ever need to build the .js files manually. @packages/ts provides require-time transpilation when in development.
npm run build-js
Testing
Tests are located in ./test
To run tests:
npm run test
Additionally, the server package contains tests that use the proxy.