Files
cypress/packages/proxy/lib/http/util/top-simulation.ts
T
Bill Glesias 695dd275bc feat: same origin spec bridges (#23885)
* chore: enforce strict origin spec bridges

chore: refactor spec bridges to strictly enforce same origin

fix: wrap fullCrossOrigin injection around feature flag inside buffered response

* fix: do NOT set the initial cypress cookie inside the spec bridge as it is sending unecessary cookies

* chore: simplify the finding cypress in the injection code

* chore: change order in which callback fn is declared

* chore: add spec bridge performance issue to validation tests
2022-10-04 18:26:04 -04:00

15 lines
635 B
TypeScript

import type { HttpMiddlewareThis } from '../index'
export const doesTopNeedToBeSimulated = <T>(ctx: HttpMiddlewareThis<T>): boolean => {
const currentAUTUrl = ctx.getAUTUrl()
// if the AUT url is undefined for whatever reason, return false as we do not want to complicate top simulation
if (!currentAUTUrl) {
return false
}
// only simulate top if the AUT is NOT the primary super domain origin, meaning that we should treat the AUT as top
// or the request is the AUT frame, which is common for redirects and navigations.
return !ctx.remoteStates.isPrimarySuperDomainOrigin(currentAUTUrl) || ctx.req.isAUTFrame
}