Skip to content

Commit 5d620aa

Browse files
anderskmananbordia
authored and
mananbordia
committed
test_classes: Add Content-Type header to empty DELETE/POST bodies.
Signed-off-by: Anders Kaseorg <[email protected]>
1 parent 8908a03 commit 5d620aa

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

zerver/lib/test_classes.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,15 @@ def client_delete(
478478
django_client = self.client # see WRAPPER_COMMENT
479479
self.set_http_headers(extra, skip_user_agent)
480480
result = django_client.delete(
481-
url, encoded, follow=follow, secure=secure, headers=headers, **extra
481+
url,
482+
encoded,
483+
follow=follow,
484+
secure=secure,
485+
headers={
486+
"Content-Type": "application/x-www-form-urlencoded", # https://code.djangoproject.com/ticket/33230
487+
**(headers or {}),
488+
},
489+
**extra,
482490
)
483491
self.validate_api_response_openapi(
484492
url,
@@ -551,7 +559,10 @@ def client_post(
551559
encoded,
552560
follow=follow,
553561
secure=secure,
554-
headers=headers,
562+
headers={
563+
"Content-Type": content_type, # https://code.djangoproject.com/ticket/33230
564+
**(headers or {}),
565+
},
555566
content_type=content_type,
556567
**extra,
557568
)

0 commit comments

Comments
 (0)