From 2dd1bc4dcdaf9136a4fa89ac0265f56efdcbfa37 Mon Sep 17 00:00:00 2001 From: Taisia Pitko Date: Wed, 11 Sep 2024 00:45:37 +0200 Subject: [PATCH] [patch] fix response status (#239) --- src/common/utils.ts | 1 + src/setup/request-events.ts | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/common/utils.ts b/src/common/utils.ts index c13225c..56a88b8 100644 --- a/src/common/utils.ts +++ b/src/common/utils.ts @@ -18,6 +18,7 @@ export type CypressDataRequest = { body?: any; method?: string; url: string; + status?: number; resourceType?: string; }; diff --git a/src/setup/request-events.ts b/src/setup/request-events.ts index d8c9840..1ab8185 100644 --- a/src/setup/request-events.ts +++ b/src/setup/request-events.ts @@ -88,6 +88,10 @@ export const logRequestEvents = (requests: FullRequest[], events: EventEmitter) current.response.data = {}; } + if (!current.response.statusCode) { + current.response.statusCode = res.status; + } + current.response.data.headers = res.headers; const result = convertToRequestsResponse(current);