Priority
Medium — generated handler correctness and Go-version resilience.
Context
Generated action/form parsing code detects oversized request bodies by checking whether err.Error() contains the text "request body too large" after ParseForm or ParseMultipartForm fails.
The request body is capped with http.MaxBytesReader, but the generated branch classifies the resulting error through string matching.
Problem
String-matching error messages is brittle.
Risks:
- Go's wrapped error text can change across versions.
- Localization or upstream wording changes can break classification.
- A different parsing error could contain the same phrase and be misclassified.
- Generated code should model request-limit failures as typed behavior, not textual heuristics.
The intended behavior is stable: body-limit failures should return 413 Request Entity Too Large; ordinary malformed form data should return 400 Bad Request.
Proposed direction
Use typed error detection in generated handlers.
For example, generated code can use errors.As(err, *http.MaxBytesError) or a small runtime helper:
if gowdkapp.IsRequestBodyTooLarge(err) {
writeError(http.StatusRequestEntityTooLarge, "request body too large")
return true
}
A runtime helper keeps generated source smaller and centralizes compatibility handling.
Acceptance criteria
Priority
Medium — generated handler correctness and Go-version resilience.
Context
Generated action/form parsing code detects oversized request bodies by checking whether
err.Error()contains the text"request body too large"afterParseFormorParseMultipartFormfails.The request body is capped with
http.MaxBytesReader, but the generated branch classifies the resulting error through string matching.Problem
String-matching error messages is brittle.
Risks:
The intended behavior is stable: body-limit failures should return
413 Request Entity Too Large; ordinary malformed form data should return400 Bad Request.Proposed direction
Use typed error detection in generated handlers.
For example, generated code can use
errors.As(err, *http.MaxBytesError)or a small runtime helper:A runtime helper keeps generated source smaller and centralizes compatibility handling.
Acceptance criteria
errors.Asor a runtime helper with typed checks.http.MaxBytesErrorand unrelated errors containing similar text.