Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(json-api-express): make sure response status is a number #370

Merged
merged 3 commits into from
Dec 12, 2023

Conversation

nelson6e65
Copy link
Contributor

Regardless of Error instance has status property as string, convert it to number for res.status().

Fixes #369

Regardless of Error instance has `status` property as string, convert it to number for `res.status()`.

Fixes kurierjs#369
joelalejandro
joelalejandro previously approved these changes Dec 12, 2023
src/middlewares/json-api-express.ts Show resolved Hide resolved
@nelson6e65
Copy link
Contributor Author

nelson6e65 commented Dec 12, 2023

Ah, I remember that type problem, @joelalejandro . That's why I used +. You can use:

Number.parseInt(`${error.status}`, 10)

@joelalejandro
Copy link
Member

joelalejandro commented Dec 12, 2023

Nah, haha, this was a readability change, I'd rather keep the + in that case. Reverting that last commit.

@joelalejandro joelalejandro reopened this Dec 12, 2023
@joelalejandro joelalejandro merged commit d741f0f into kurierjs:main Dec 12, 2023
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[1.3.x] errors.status should be a string
2 participants