Fix the In-Depth Example in the docs to return bytes

FJ
6d ago
+3-3

The two "In-Depth Example" snippets on the docs index page (docs/index.md) return str objects from a WSGI app. On Python 3, wsgiref rejects them with AssertionError: write() argument must be a bytes instance, so both snippets answer 500 Internal Server Error instead of the output shown on the page. The same problem was reported for the old docs site in #36.

This makes the snippets return bytes and starts the final example with the Hashes: line that the sample output already shows.

I extracted the three Python blocks from docs/index.md, ran each in a thread instead of serve_forever(), and hit them with curl. I used python-multipart 0.0.31 and CPython 3.12.14.

examplebeforeafter
Simple Example (-F foo=bar)200 Parsed value parameter named: foounchanged
In-Depth, first app (GET /)500 (write() argument must be a bytes instance)200 Hashes:
In-Depth, final app (-F file=@test.txt)500 (same)200 Hashes: / Part hash: 0b64696c…d931 (matches shasum -a 256 in the docs)

I used an AI assistant (Claude) to help find and draft this change. I reviewed and tested it myself.

🤖 Generated with Claude Code

🤖 Generated with Claude Code