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

fix: do not require Chi for humatest #370

Merged
merged 3 commits into from
Apr 10, 2024
Merged

fix: do not require Chi for humatest #370

merged 3 commits into from
Apr 10, 2024

Conversation

danielgtaylor
Copy link
Owner

This PR decouples the humatest package from the Chi router, which was a pain for anyone using a router other than Chi. It also forced a non-stdlib dependency when using the humago stdlib adapter, which is not ideal. Because we can't yet rely on Go 1.22's stdlib router (Huma works with Go 1.20+), this embeds a tiny little 200 line router package used for testing. You can continue to use humatest.Wrap to wrap any other router/API as desired.

This is a slight breaking change due to the removal of Chi in some function signatures, but worth it to fix the larger dependency issue. I am treating it as a fix rather than a major breaking change and will put plenty of notes about it in the release.

Additionally, this makes the dumped request/response during testing more readable (pretty prints JSON by default) and provides utility functions to print the request/response to stdout.

@danielgtaylor danielgtaylor merged commit 11640d9 into main Apr 10, 2024
3 checks passed
@danielgtaylor danielgtaylor deleted the humatest-no-chi branch April 10, 2024 18:27
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