fix: reject structured weather query parameters #25
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/w8-weather-query-params"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes W8 from bugs.md.
Adds terminal clauses to
validate_required_float/2andvalidate_optional_integer/3so array/map query values (?lat[]=1,?limit[a]=1) return the documented 400 instead of raisingCaseClauseErrorinto a 500 and an ErrorTracker row. Three regression tests cover array/map lat and array limit.Verification: focused weather controller tests passed (20), full suite passed (2238),
mix credo --strict, and commit hooks including Dialyzer passed.No findings. The two terminal clauses now cover every shape Plug can decode into these keys — lists (from
lat[]=,lat[]=a&lat[]=b, or a repeated plain key) and maps (fromlat[a]=) — and both fall through to the same{:error, :bad_request, msg}tuple the action fallback already renders as 400, so theCaseClauseError→ 500 path is closed forlat/lon/radius/hours/limitalike (lon,radiusandhourshave no test but share the same clauses).The three regression tests drive real nested params through Plug's query encoder rather than a synthetic map, so they would genuinely fail if either clause regressed.