[PR #1440] [MERGED] fix: status code detection #3314

Closed
opened 2026-03-17 00:56:19 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/1440
Author: @dunglas
Created: 1/24/2021
Status: Merged
Merged: 1/25/2021
Merged by: @liyasthomas

Base: mainHead: fix/status-detection


📝 Commits (2)

  • d76a1f2 fix: status code detection
  • ad331b6 Merge branch 'main' into fix/status-detection

📊 Changes

1 file changed (+35 additions, -34 deletions)

View changed files

📝 helpers/findStatusGroup.js (+35 -34)

📄 Description

The current regular expressions detecting status code classes are incorrect. For instance 422 (which is returned by Rails, Symfony and API Platform when a request is invalid because of invalid user data) is detected as belonging to the success class instead of client error because it contains the number 2.

The regex should be something like /^4\d{2}$/ but using a RegExp here isn't necessary, so I switched to simple numerical comparisons (which are faster).

image

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hoppscotch/hoppscotch/pull/1440 **Author:** [@dunglas](https://github.com/dunglas) **Created:** 1/24/2021 **Status:** ✅ Merged **Merged:** 1/25/2021 **Merged by:** [@liyasthomas](https://github.com/liyasthomas) **Base:** `main` ← **Head:** `fix/status-detection` --- ### 📝 Commits (2) - [`d76a1f2`](https://github.com/hoppscotch/hoppscotch/commit/d76a1f2aae027c84a5b6e47069c40b013492e566) fix: status code detection - [`ad331b6`](https://github.com/hoppscotch/hoppscotch/commit/ad331b66ee40a6cc7551732f001a86e51565cebf) Merge branch 'main' into fix/status-detection ### 📊 Changes **1 file changed** (+35 additions, -34 deletions) <details> <summary>View changed files</summary> 📝 `helpers/findStatusGroup.js` (+35 -34) </details> ### 📄 Description The current regular expressions detecting status code classes are incorrect. For instance `422` (which is returned by Rails, Symfony and API Platform when a request is invalid because of invalid user data) is detected as belonging to the `success` class instead of `client error` because it contains the number `2`. The regex should be something like `/^4\d{2}$/` but using a RegExp here isn't necessary, so I switched to simple numerical comparisons (which are faster). <img width="840" alt="image" src="https://user-images.githubusercontent.com/57224/105640026-00f5da80-5e7c-11eb-9ca6-24c18bc5ff7b.png"> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-17 00:56:19 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#3314
No description provided.