From 9135ce69c0e53c662a959eab296cbc304a7d4166 Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Sun, 22 Feb 2026 16:18:45 +0100 Subject: [PATCH] add bad_request function with extended information --- radicale/httputils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/radicale/httputils.py b/radicale/httputils.py index 81e01715..0e829c6b 100644 --- a/radicale/httputils.py +++ b/radicale/httputils.py @@ -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``."""