Skip to content

Flask: non-JSON input mappers, send_*_resp content types, 400 on bad bodies (#40) - #43

Merged
thorwhalen merged 3 commits into
masterfrom
flask-request-handling
Oct 13, 2026
Merged

thorwhalen merged 3 commits into
masterfrom
flask-request-handling

Conversation

@thorwhalen

Copy link
Copy Markdown
Member

Fixes the first three items of #40; the fourth (Bottle-only configs) is split to #42.

  • Raw, binary and form input mappers read the body/files through helpers that work for Bottle and Flask requests (duck-typed on get_data).
  • Under Flask a mapper that declares a content_type and returns a str/bytes body (send_json_resp, send_raw_resp, send_binary_resp) now answers that content type (flask_response_mapper, applied by framework_defaults).
  • Empty, non-JSON or non-object bodies, a missing __fields form part and a wrong request content type raise InputError (400) for both frameworks instead of a 500 (previously RuntimeError / werkzeug text).
  • Tests: py2http/tests/test_flask_requests.py. Dependents gate (extrude): pass.

🤖 Generated with Claude Code

thorwhalen and others added 2 commits October 13, 2026 14:23
…pes, 400 on bad bodies (#40)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…type

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@thorwhalen

Copy link
Copy Markdown
Member Author

Adversarial review (fresh Opus): no Bottle regressions; 1 confirmed regression (Flask rejecting BOM/UTF-16 JSON that master accepted) and case-sensitive content type, both fixed with tests; remaining minor gaps recorded on #42.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.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