From 97ece9a96db8bd06c8984a984ec3c17ca95d489a Mon Sep 17 00:00:00 2001 From: Wang Riwu Date: Fri, 22 Sep 2023 00:21:44 +0800 Subject: [PATCH] fix: statusCode allow 999 https://lodash.com/docs/#inRange `end` is exclusive, so it needs to be set to 1000 to allow status code 999 to be included (as per documented). --- cli/CHANGELOG.md | 4 ++++ packages/driver/src/cy/net-stubbing/static-response-utils.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cli/CHANGELOG.md b/cli/CHANGELOG.md index 6418a505b6e8..87bedc39fd74 100644 --- a/cli/CHANGELOG.md +++ b/cli/CHANGELOG.md @@ -7,6 +7,10 @@ _Released 09/19/2023 (PENDING)_ - Introduces new layout for Runs page providing additional run information. Addresses [#27203](https://github.com/cypress-io/cypress/issues/27203). +**Bugfixes:** + +- Fixed net stubbing not permitting status code 999. Addressed in [#27853](https://github.com/cypress-io/cypress/pull/27853). + ## 13.2.0 _Released 09/12/2023_ diff --git a/packages/driver/src/cy/net-stubbing/static-response-utils.ts b/packages/driver/src/cy/net-stubbing/static-response-utils.ts index 12cd1eb0d777..59196b74d4f5 100644 --- a/packages/driver/src/cy/net-stubbing/static-response-utils.ts +++ b/packages/driver/src/cy/net-stubbing/static-response-utils.ts @@ -41,7 +41,7 @@ export function validateStaticResponse (cmd: string, staticResponse: StaticRespo // statusCode must be a three-digit integer // @see https://tools.ietf.org/html/rfc2616#section-6.1.1 - if (statusCode && !(_.isNumber(statusCode) && _.inRange(statusCode, 100, 999))) { + if (statusCode && !(_.isNumber(statusCode) && _.inRange(statusCode, 100, 1000))) { err('`statusCode` must be a number between 100 and 999 (inclusive).') }