mirror of
https://github.com/cypress-io/cypress.git
synced 2026-02-13 18:50:18 -06:00
* chore: add type linting + compilation checks to runner package * empty commit * A bunch of tslint fixes * wow it is building * Fix issue with CT not mounting correctly with comments within it * Fix net-stubbing.ct.ts failures * Fix tslint: disable comment * move target into compilerOptions * fix tslint disable comment * update proxy-logging to undo changes * standardize the tslint:disable comments * fix comment * fix the banner content not displaying and write a test for this situation * fix ct reference * put target to es2020 * actually set the property with replaced title * Update packages/reporter/src/hooks/hook-model.ts Co-authored-by: Ryan Manuel <ryanm@cypress.io> * Fix eslint/tslint settings for system-tests with vue 3 * bump CI cache * update types/react resolution * add return * lint fix * tslint disable for empty blocks * exclude dist files from ts linting * update to exclude all dist folder * exclude dist file * change to await * fix line numbers of stack trace with linting updating vue file --------- Co-authored-by: Ryan Manuel <ryanm@cypress.io>
83 lines
2.3 KiB
TypeScript
83 lines
2.3 KiB
TypeScript
import { telemetry } from '@packages/telemetry'
|
|
import { Http, ServerCtx } from './http'
|
|
import type { BrowserPreRequest } from './types'
|
|
import type Protocol from 'devtools-protocol'
|
|
import type { ServiceWorkerClientEvent } from './http/util/service-worker-manager'
|
|
|
|
export class NetworkProxy {
|
|
http: Http
|
|
|
|
constructor (opts: ServerCtx) {
|
|
this.http = new Http(opts)
|
|
}
|
|
|
|
async addPendingBrowserPreRequest (preRequest: BrowserPreRequest) {
|
|
await this.http.addPendingBrowserPreRequest(preRequest)
|
|
}
|
|
|
|
removePendingBrowserPreRequest (requestId: string) {
|
|
this.http.removePendingBrowserPreRequest(requestId)
|
|
}
|
|
|
|
getPendingBrowserPreRequests () {
|
|
return this.http.getPendingBrowserPreRequests()
|
|
}
|
|
|
|
addPendingUrlWithoutPreRequest (url: string) {
|
|
this.http.addPendingUrlWithoutPreRequest(url)
|
|
}
|
|
|
|
updateServiceWorkerRegistrations (data: Protocol.ServiceWorker.WorkerRegistrationUpdatedEvent) {
|
|
this.http.updateServiceWorkerRegistrations(data)
|
|
}
|
|
|
|
updateServiceWorkerVersions (data: Protocol.ServiceWorker.WorkerVersionUpdatedEvent) {
|
|
this.http.updateServiceWorkerVersions(data)
|
|
}
|
|
|
|
updateServiceWorkerClientSideRegistrations (data: { scriptURL: string, initiatorOrigin: string }) {
|
|
this.http.updateServiceWorkerClientSideRegistrations(data)
|
|
}
|
|
|
|
handleServiceWorkerClientEvent (event: ServiceWorkerClientEvent) {
|
|
this.http.handleServiceWorkerClientEvent(event)
|
|
}
|
|
|
|
async handleHttpRequest (req, res) {
|
|
const span = telemetry.startSpan({
|
|
name: 'network:proxy:handleHttpRequest',
|
|
opts: {
|
|
attributes: {
|
|
'network:proxy:url': req.proxiedUrl,
|
|
'network:proxy:contentType': req.get('content-type'),
|
|
},
|
|
},
|
|
isVerbose: true,
|
|
})
|
|
|
|
await this.http.handleHttpRequest(req, res, span).finally(() => {
|
|
span?.end()
|
|
})
|
|
}
|
|
|
|
async handleSourceMapRequest (req, res) {
|
|
await this.http.handleSourceMapRequest(req, res)
|
|
}
|
|
|
|
setHttpBuffer (buffer) {
|
|
this.http.setBuffer(buffer)
|
|
}
|
|
|
|
reset (options: { resetBetweenSpecs: boolean } = { resetBetweenSpecs: false }) {
|
|
this.http.reset(options)
|
|
}
|
|
|
|
setProtocolManager (protocolManager) {
|
|
this.http.setProtocolManager(protocolManager)
|
|
}
|
|
|
|
setPreRequestTimeout (timeout) {
|
|
this.http.setPreRequestTimeout(timeout)
|
|
}
|
|
}
|