From aa59f2193d30cbdfa094d79118eb98c9254715a5 Mon Sep 17 00:00:00 2001 From: Bill Glesias Date: Wed, 14 Sep 2022 15:04:36 -0400 Subject: [PATCH] test: add anti assertion for x-cypress-request and remove setting request verbage (as it does nothing yet) --- .../test/unit/http/request-middleware.spec.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/proxy/test/unit/http/request-middleware.spec.ts b/packages/proxy/test/unit/http/request-middleware.spec.ts index 9a5e822cb7a8..7a2968dbeb3b 100644 --- a/packages/proxy/test/unit/http/request-middleware.spec.ts +++ b/packages/proxy/test/unit/http/request-middleware.spec.ts @@ -59,7 +59,7 @@ describe('http/request-middleware', () => { }) }) - it('removes x-cypress-request header when it exists, sets in on the req', async () => { + it('removes x-cypress-request header when it exists', async () => { const ctx = { req: { headers: { @@ -73,6 +73,19 @@ describe('http/request-middleware', () => { expect(ctx.req.headers['x-cypress-request']).not.to.exist }) }) + + it('removes x-cypress-request header when it does not exist', async () => { + const ctx = { + req: { + headers: {}, + } as Partial, + } + + await testMiddleware([ExtractCypressMetadataHeaders], ctx) + .then(() => { + expect(ctx.req.headers['x-cypress-request']).not.to.exist + }) + }) }) describe('MaybeSimulateSecHeaders', () => {