Skip to content

middleware/parameter.go: fix comment describing ParseForm fallback#451

Merged
fredbi merged 1 commit into
masterfrom
copilot/fix-comment-parameter-go
May 14, 2026
Merged

middleware/parameter.go: fix comment describing ParseForm fallback#451
fredbi merged 1 commit into
masterfrom
copilot/fix-comment-parameter-go

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 14, 2026

The comment describing the form-parsing helper's Content-Type routing was misleading: it said "otherwise → ParseForm", implying only application/x-www-form-urlencoded triggers ParseForm. In reality, all non-multipart content types fall through to ParseForm — matching the actual logic in form.go.

  • middleware/parameter.go: replace otherwise → ParseForm with an explicit statement that all non-multipart types, including application/x-www-form-urlencoded, route to ParseForm
Original prompt
Please apply the following diffs and create a pull request.
Once the PR is ready, give it a title based on the messages of the fixes being applied.

[{"message":"Comment incorrectly states 'otherwise → ParseForm'. According to form.go lines 243-248, only multipart/form-data triggers ParseMultipartForm; all other content types (including application/x-www-form-urlencoded) go through ParseForm. The comment should clarify that the fallback applies to all non-multipart content types, not just urlencoded forms.","fixFiles":[{"filePath":"middleware/parameter.go","diff":"diff --git a/middleware/parameter.go b/middleware/parameter.go\n--- a/middleware/parameter.go\n+++ b/middleware/parameter.go\n@@ -100,7 +100,8 @@\n \t\t}\n \n \t\t// Parse via the shared helper. The helper routes on Content-Type\n-\t\t// (multipart/form-data → ParseMultipartForm, otherwise → ParseForm)\n+\t\t// (multipart/form-data → ParseMultipartForm; all non-multipart types,\n+\t\t// including application/x-www-form-urlencoded, → ParseForm)\n \t\t// and applies the default 32 MiB body cap via http.MaxBytesReader.\n \t\t// Idempotent across the per-parameter loop: stdlib short-circuits\n \t\t// when r.MultipartForm / r.PostForm are already populated.\n"}]}]

Copilot AI changed the title [WIP] Fix comment clarification in parameter.go regarding ParseForm usage middleware/parameter.go: fix comment describing ParseForm fallback May 14, 2026
Copilot finished work on behalf of fredbi May 14, 2026 21:10
Copilot AI requested a review from fredbi May 14, 2026 21:10
@fredbi fredbi marked this pull request as ready for review May 14, 2026 21:24
@fredbi fredbi force-pushed the copilot/fix-comment-parameter-go branch from 9aac09b to 6ee37dc Compare May 14, 2026 21:44
@codecov
Copy link
Copy Markdown

codecov Bot commented May 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (master@09c03d0). Learn more about missing BASE report.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff            @@
##             master     #451   +/-   ##
=========================================
  Coverage          ?   83.45%           
=========================================
  Files             ?       62           
  Lines             ?     4387           
  Branches          ?        0           
=========================================
  Hits              ?     3661           
  Misses            ?      567           
  Partials          ?      159           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fredbi fredbi merged commit 649e529 into master May 14, 2026
54 of 58 checks passed
@fredbi fredbi deleted the copilot/fix-comment-parameter-go branch May 14, 2026 22:12
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.

2 participants