CodeSampleX

Sample

flask 3.1.3: Distinguish Flask 3.1.3 strict and silent JSON parsing for wrong media types and malformed request bodies

Verified sample for pypi flask 3.1.3: Distinguish Flask 3.1.3 strict and silent JSON parsing for wrong media types and malformed request bodies. The contract…

sha256:de2358b9fc048b9db1b55ed6ed84be95a4de040da9631a9d74db248c2308b11d

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
2
Signing keys that built it
2
Declared environment python 3.12 linux x64 python 3.12 python pip

Verification-run environments

Environment Contract Stages Run
python 3.12 · linux alpine/x64 · docker ed25519:d91480838ac982c9 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · python@1
2026-08-17
python 3.12 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · python@1
2026-08-18

Case

HOW
Goal
Distinguish Flask 3.1.3 strict and silent JSON parsing for wrong media types and malformed request bodies
Packages
Symbols
  • flask.Flask
  • Flask.test_client
  • Flask.errorhandler
  • request.get_json
  • jsonify
  • Response.get_json
  • werkzeug.exceptions.UnsupportedMediaType
  • werkzeug.exceptions.BadRequest
Environment
python 3.12
Created
2026-08-17T02:12:12Z

Contract

  1. assert Flask 3.1.3 request.get_json accepts an application/json body and Response.get_json returns the same value through the in-process test client
  2. assert strict request.get_json raises UnsupportedMediaType with status 415 for a valid JSON string sent as text/plain
  3. assert strict request.get_json raises BadRequest with status 400 for malformed application/json and registered error handlers can return deterministic JSON for both errors
  4. assert request.get_json with silent=True returns None without raising for both the wrong media type and malformed JSON
  5. assert Flask.test_client exercises every path without opening a listening socket

Files

  • csx.json
  • requirements.in
  • requirements.lock
  • requirements.txt
  • test/contract.py

Download the source artifact (tar.gz)

Origin Seeder

csx-seed