-
-
Notifications
You must be signed in to change notification settings - Fork 284
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: HaveHTTPStatus multiple expected values (#465)
* feat: formatter for HTTP responses Previously when the HaveHTTPStatus() matcher failed, the whole HTTP response object was printed out, and any message was rendered in bytes rather than as a string. This introduces a formatter for HTTP responses, so that the key data is presented in a helpful format. * feat: HaveHTTPStatus multiple expected values Sometimes more than one HTTP status is acceptable. For example a server may (correctly) return HTTP 204 for an empty response, or it might return HTTP 200 for an empty response - and we might want to accept either. We can now write: ```go Expect(resp).To(HaveHTTPStatus(http.StatusOK, http.StatusNoContent)) ``` And it will match either. This is simpler than using Or() or SatisfyAny(). Co-authored-by: Onsi Fakhouri <[email protected]>
- Loading branch information
Showing
3 changed files
with
135 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters