Repository navigation
test: add gin body_limit coverage (gin#247) - #154
Merged
Merged
Conversation
hwbrzzl
reviewed
Sep 25, 2026
Comment on lines
+173
to
+178
|
|
||
| // One byte over the 4 MiB fallback is rejected. | ||
| over := `{"test":"` + strings.Repeat("a", defaultBodyLimitByte+1) + `"}` | ||
| resp, err = facades.Http().WithHeader("Content-Type", "application/json"). | ||
| Post("/input-map", strings.NewReader(over)) | ||
| s.assertBodyTooLarge(resp, err) |
Contributor
There was a problem hiding this comment.
Remove these lines directly.
Contributor
Author
There was a problem hiding this comment.
Removed those lines in 1679b10, along with the now-unused defaultBodyLimitByte const and the stale doc comment that still described the ~4 MiB boundary. TestBodyLimitDefaultFallback now only checks that body_limit: 0 keeps serving normal requests.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
HttpClientTestSuiteand drive the bounded over/under cases — JSON, unmatched route, form, multipart, at-the-limit, and chunked — through the app's realfacades.Http()client against the live server, so gin and fiber both answer a real413 Request Entity Too Largewith no driver branching.body_limit: 0fallback through the same real client to confirm normal requests stay accepted, and shareassertBodyTooLargewith the bounded cases, dropping the separate in-process helper and itsfasthttp/testing-http imports.HttpClientTestSuiteunder fiber as well, viaTestFiberDriver, so both drivers exercise the same suite.Why
This PR adds integration coverage for the request body limit fixed in goravel/gin#247. An earlier revision drove the over-limit cases through the in-process
httptestharness, where fiber surfacedfasthttp.ErrBodyTooLargewith no response and the assertions had to branch on the driver. The cases now go through the app's real HTTP client, so the contract is verified on the wire: an over-limit body is rejected with413 Request Entity Too Largebefore any handler runs, while a body exactly at the limit is still accepted.The
body_limit: 0case now asserts only that normal requests keep being served: asserting the 4 MiB boundary would race the server'sContent-Lengthrejection against the client's upload, so that boundary is left unasserted rather than made flaky. The gin dependency is pinned to467f03c, the upstream merge commit of goravel/gin#247, so the fix is consumed straight from upstream with no fork replace.