From 9fd5e9af4a9aa3d75bf2ad4898f8ed8e61bce482 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Sun, 22 Oct 2023 23:00:52 -0700 Subject: [PATCH] test_classes: Add Content-Type header to empty DELETE/POST bodies. Signed-off-by: Anders Kaseorg (cherry picked from commit 0dd92d21166a7fe0ae4015a937a360cedb5e5ec5) --- zerver/lib/test_classes.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/zerver/lib/test_classes.py b/zerver/lib/test_classes.py index 76d8a7edeb..587879b869 100644 --- a/zerver/lib/test_classes.py +++ b/zerver/lib/test_classes.py @@ -478,7 +478,15 @@ Output: django_client = self.client # see WRAPPER_COMMENT self.set_http_headers(extra, skip_user_agent) result = django_client.delete( - url, encoded, follow=follow, secure=secure, headers=headers, **extra + url, + encoded, + follow=follow, + secure=secure, + headers={ + "Content-Type": "application/x-www-form-urlencoded", # https://code.djangoproject.com/ticket/33230 + **(headers or {}), + }, + **extra, ) self.validate_api_response_openapi( url, @@ -551,7 +559,10 @@ Output: encoded, follow=follow, secure=secure, - headers=headers, + headers={ + "Content-Type": content_type, # https://code.djangoproject.com/ticket/33230 + **(headers or {}), + }, content_type=content_type, **extra, )