[PATCH 2/3] uclient-fetch: Simplify uclient_request_supports_body()

Sergey Ponomarev stokito at gmail.com
Thu Apr 6 14:39:08 PDT 2023


Only GET and HEAD shouldn't have a body

Signed-off-by: Sergey Ponomarev <stokito at gmail.com>
---
 uclient-http.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/uclient-http.c b/uclient-http.c
index 80d4495..02bb7c2 100644
--- a/uclient-http.c
+++ b/uclient-http.c
@@ -292,14 +292,7 @@ static void uclient_http_process_headers(struct uclient_http *uh)
 
 static bool uclient_request_supports_body(enum request_type req_type)
 {
-	switch (req_type) {
-	case REQ_POST:
-	case REQ_PUT:
-	case REQ_DELETE:
-		return true;
-	default:
-		return false;
-	}
+	return !(req_type == REQ_GET || req_type == REQ_HEAD);
 }
 
 static int
-- 
2.37.2




More information about the openwrt-devel mailing list