Skip to content

middleware: return after JSON decode error in BindHTTPReq#82

Merged
0xFelix merged 1 commit intomainfrom
fix/httpreq-json-decode-return
Apr 19, 2026
Merged

middleware: return after JSON decode error in BindHTTPReq#82
0xFelix merged 1 commit intomainfrom
fix/httpreq-json-decode-return

Conversation

@0xFelix
Copy link
Copy Markdown
Owner

@0xFelix 0xFelix commented Apr 19, 2026

Summary

  • BindHTTPReq in pkg/middleware/bind.go was missing a return after writing a 400 header on JSON decode failure.
  • Execution continued into the d.FQDN == \"\" check, which called http.Error again and produced a superfluous WriteHeader log plus a misleading fqdn is missing body.
  • Other Bind* handlers return correctly in the analogous spot; this aligns BindHTTPReq with them.

Test plan

  • make lint
  • make test (18/18 pass)
  • make functest (68/68 pass)

Without the return, a decode failure wrote a 400 header and fell through
to the d.FQDN check, triggering a superfluous WriteHeader call and
emitting a misleading 'fqdn is missing' body.

Signed-off-by: 0xFelix <felix@matouschek.org>
@0xFelix 0xFelix merged commit 0bbd066 into main Apr 19, 2026
5 checks passed
@0xFelix 0xFelix deleted the fix/httpreq-json-decode-return branch April 19, 2026 14:53
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