alba icon indicating copy to clipboard operation
alba copied to clipboard

Created an Assertion for StatusCodeShouldBeSuccess

Open JeffryGonzalez opened this issue 2 years ago • 0 comments

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.

JeffryGonzalez avatar May 27 '24 17:05 JeffryGonzalez