Skip to content

fix(bind): handle maps with defined string key and value types - #3150

Open
sergioperezcheco wants to merge 1 commit into
labstack:masterfrom
sergioperezcheco:fix/bind-named-string-maps-20261004
Open

sergioperezcheco wants to merge 1 commit into
labstack:masterfrom
sergioperezcheco:fix/bind-named-string-maps-20261004

Conversation

@sergioperezcheco

Copy link
Copy Markdown

The map binder checks string kinds, but then assigns plain string keys and values without converting them to the destination types. Normal requests therefore panic when binding to maps with a defined string key or value type. Convert those two values before assignment, preserving the existing first-value behavior for string and interface destinations and all-values behavior for slice destinations.

The regression exercises Context.Bind and explicit query, path, header, URL-encoded form and multipart binding through Echo.ServeHTTP, including nil map allocation and ordinary map controls. The unchanged implementation fails 24 of the 48 cases; the fix passes the full local race suite and go vet, with no incremental govet/staticcheck findings. CI's standalone golint/staticcheck, other Go versions and other operating systems have not been run locally.

Prepared with Hermes Agent; no human review is claimed.

Prepared with Hermes Agent (gpt-6.1-sol).

Signed-off-by: sergioperezcheco <checo520@outlook.com>
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