commit 6b2609c2b861b9e0a99390dd8acc4dca1dc515f1
parent a9ee15bff6f5c154647ec994771645c34345fb4c
Author: Joris Vink <joris@coders.se>
Date: Mon, 6 Dec 2021 14:16:58 +0100
Allow DELETE for kore.httpclient() to have body.
The DELETE method could have an HTTP body, so allow it in the
kore.httpclient() python call.
Diffstat:
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/python.c b/src/python.c
@@ -6292,15 +6292,20 @@ pyhttp_client_request(struct pyhttp_client *client, int m, PyObject *kwargs)
switch (m) {
case HTTP_METHOD_GET:
case HTTP_METHOD_HEAD:
- case HTTP_METHOD_DELETE:
case HTTP_METHOD_OPTIONS:
break;
case HTTP_METHOD_PUT:
case HTTP_METHOD_POST:
case HTTP_METHOD_PATCH:
+ case HTTP_METHOD_DELETE:
length = -1;
if (kwargs == NULL) {
+ if (m == HTTP_METHOD_DELETE) {
+ length = 0;
+ break;
+ }
+
PyErr_Format(PyExc_RuntimeError,
"no keyword arguments given, but body expected ",
http_method_text(m));