yhirose 5 年之前
父節點
當前提交
be7962f140
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      httplib.h

+ 2 - 1
httplib.h

@@ -3043,7 +3043,8 @@ get_range_offset_and_length(const Request &req, const Response &res,
 
 inline bool expect_content(const Request &req) {
   if (req.method == "POST" || req.method == "PUT" || req.method == "PATCH" ||
-      req.method == "PRI" || req.method == "DELETE") {
+      req.method == "PRI" ||
+      (req.method == "DELETE" && req.has_header("Content-Length"))) {
     return true;
   }
   // TODO: check if Content-Length is set