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

feat: add response status assertions shortcuts #6

Merged

Conversation

luffynando
Copy link
Contributor

❓ Type of change

  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Details

Methods have been added to the response class that are shortcuts to assert a status of http code, following the name nomenclature present in ResponseStatus

List of added methods:

Method Assert status
assertOk 200
assertCreated 201
assertAccepted 202
assertNoContent 204
assertMovedPermanently 301
assertFound 302
assertBadRequest 400
assertUnauthorized 401
assertPaymentRequired 402
assertForbidden 403
assertNotFound 404
assertMethodNotAllowed 405
assertNotAcceptable 406
assertRequestTimeout 408
assertConflict 409
assertGone 410
assertLengthRequired 411
assertPreconditionFailed 412
assertPayloadTooLarge 413
assertURITooLong 414
assertUnsupportedMediaType 415
assertRangeNotSatisfiable 416
assertImATeapot 418
assertUnprocessableEntity 422
assertLocked 423
assertTooManyRequests 429

Why

They are mainly shortcuts that provide easier reading to understand what http status the test is checking.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Additional Information

If this PR gets merged, I'll make a PR to the japa docs.

@thetutlage
Copy link
Contributor

Looks good. Let's get the PR ready for the docs πŸ‘

@thetutlage thetutlage merged commit 0cac856 into japa:develop Nov 28, 2024
6 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.

2 participants