chore: Add test coverage for multipart BodyLimit error handling - #4237
Conversation
Agent-Logs-Url: https://github.com/gofiber/fiber/sessions/40fc5de4-74d2-411b-885d-f6fd77d25222 Co-authored-by: gaby <835733+gaby@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4237 +/- ##
=======================================
Coverage 91.25% 91.25%
=======================================
Files 127 127
Lines 12556 12556
=======================================
Hits 11458 11458
Misses 687 687
Partials 411 411
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds a regression integration test around Fiber’s server-level BodyLimit handling so oversized multipart/form-data requests are verified to flow through a custom ErrorHandler the same way other oversized requests already do.
Changes:
- Added a new integration test covering oversized multipart uploads with a custom JSON
ErrorHandler. - Verifies the response still returns HTTP 413 for multipart requests that exceed
BodyLimit. - Verifies the custom handler’s JSON body and content type are preserved on that failure path.
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.50.
| Benchmark suite | Current: cb6cf0c | Previous: 7dc9e8e | Ratio |
|---|---|---|---|
BenchmarkDecoderedirectionMsgs (github.com/gofiber/fiber/v3) |
20.21 ns/op 49.47 MB/s 0 B/op 0 allocs/op |
8.347 ns/op 119.81 MB/s 0 B/op 0 allocs/op |
2.42 |
BenchmarkDecoderedirectionMsgs (github.com/gofiber/fiber/v3) - ns/op |
20.21 ns/op |
8.347 ns/op |
2.42 |
This comment was automatically generated by workflow using github-action-benchmark.
Description
Oversized multipart uploads were reported as bypassing custom
ErrorHandlerresponses and surfacing as a generic client-side network error instead of a413response. This PR adds regression coverage for that path so multipart requests exceedingBodyLimitare verified to return the same custom error response shape as other oversized requests.What changed
multipart/form-datarequests handled through a customErrorHandler413 Request Entity Too LargeRegression coverage
*fiber.Errorand serialized by the app’s custom error handler, rather than failing as a transport-level"error"on the clientExample
Changes introduced
List the new features or adjustments introduced in this pull request. Provide details on benchmarks, documentation updates, changelog entries, and if applicable, the migration guide.
Type of change
Please delete options that are not relevant.
Checklist
Before you submit your pull request, please make sure you meet these requirements:
/docs/directory for Fiber's documentation.Commit formatting
Please use emojis in commit messages for an easy way to identify the purpose or intention of a commit. Check out the emoji cheatsheet here: CONTRIBUTING.md