add bad_request function with extended information

This commit is contained in:
Peter Bieringer
2026-02-22 16:18:45 +01:00
parent 05e3b462c0
commit 9135ce69c0

View File

@@ -106,6 +106,10 @@ MIMETYPES: Mapping[str, str] = {
FALLBACK_MIMETYPE: str = "application/octet-stream"
def bad_request(additional_details: str) -> types.WSGIResponse:
return (client.BAD_REQUEST, (("Content-Type", "text/plain"),), f"Bad Request: {additional_details}", None)
def decode_request(configuration: "config.Configuration",
environ: types.WSGIEnviron, text: bytes) -> str:
"""Try to magically decode ``text`` according to given ``environ``."""