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

Created an Assertion for StatusCodeShouldBeSuccess #161

Merged

Conversation

JeffryGonzalez
Copy link
Sponsor Contributor

Unsolicited contribution - but I often want to be a little fuzzy on asserting status codes (a 200 is as good as a 201, or a 204, for example). I added an assertion for api.StatusCodeShouldBeSuccess() that will pass if the status code is in the proper range of "success".

Since Alba's default behavior is to fail if there is no assertion on the status code and it returns anything but a 200, this seems like a good accommodation. (I'd prefer the default was this, but I get why others wouldn't, and don't want a breaking change anyhow).

I've had this as my own custom assertion for a while, and don't mind keeping it that way, but if it is helpful, take it.

@Hawxy Hawxy force-pushed the add-extension-for-success-status-code branch from 27b90d6 to 5b0d011 Compare July 26, 2024 08:13
@Hawxy
Copy link
Collaborator

Hawxy commented Jul 26, 2024

Thanks for the PR!

@Hawxy Hawxy merged commit c99ee6d into JasperFx:master Jul 26, 2024
1 check 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.

2 participants