test_classes: Add Content-Type header to empty DELETE/POST bodies.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
(cherry picked from commit 0dd92d2116)
This commit is contained in:
Anders Kaseorg 2023-10-22 23:00:52 -07:00 committed by Tim Abbott
parent f03cc51aca
commit 9fd5e9af4a
1 changed files with 13 additions and 2 deletions

View File

@ -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,
)