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

More comprehensive tests for HTTP verb endpoints #88

Merged
merged 1 commit into from
Oct 19, 2022

Conversation

mccutchen
Copy link
Owner

We were not explicitly testing the behavior of some HTTP verb endpoints like /put, /patch, and /delete, because they (currently) share an underlying handler with /post which is thoroughly tested.

The addition of the /anything endpoint in #83 made me realize a bit more explicit test coverage would be good, so here we're landing a bit of a refactoring of the test suite to generate tests for all of those endpoints.

Along the way, the more thorough test coverage uncovered a compatibility issue with the original httpbin implementation, which supports DELETE requests with bodies. We handle that by tricking the stdlib net/http machinery into parsing those request bodies.

We were not explicitly testing the behavior of some HTTP verb endpoints
like /put and /patch, because they currently share an underlying handler
with /post which is thoroughly tested.

The addition of the /anything endpoint in #83 made me realize a bit more
explicit test coverage would be good, so here we're landing a bit of a
refactoring of the test suite to generate tests for all of those
endpoints.

Along the way, we also improve compatibility with the original httpbin
implementation by tricking the stdlib net/http machinery into parsing
request bodies for DELETE requests.
@mccutchen mccutchen merged commit 4ec6c82 into main Oct 19, 2022
@mccutchen mccutchen deleted the refactor-request-with-body-tests branch October 19, 2022 22:15
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 participant