mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-24 21:25:45 +00:00
fix: enhance HTTP response status validation in stringifyHttpRequest function (#7117)
Updated the response status handling to ensure it is a positive integer before assignment, improving data integrity in HTTP request stringification.
This commit is contained in:
@@ -174,8 +174,9 @@ const stringifyHttpRequest = (item: BrunoItem): string => {
|
||||
if (example.response) {
|
||||
ocExample.response = {};
|
||||
|
||||
if (example.response.status !== undefined && example.response.status !== null && isNumber(example.response.status)) {
|
||||
ocExample.response.status = Number(example.response.status);
|
||||
const statusNum = Number(example.response.status);
|
||||
if (Number.isInteger(statusNum) && statusNum > 0) {
|
||||
ocExample.response.status = statusNum;
|
||||
}
|
||||
|
||||
if (isNonEmptyString(example.response.statusText)) {
|
||||
|
||||
Reference in New Issue
Block a user