From bd1cc20c93d927406d87b2b55678e702f90a4439 Mon Sep 17 00:00:00 2001 From: Ivan Shynkarenka Date: Wed, 18 Nov 2020 03:18:46 +0300 Subject: [PATCH] Fixed issue with DELETE http method --- .appveyor.yml | 2 +- source/NetCoreServer/HttpRequest.cs | 4 ++-- source/NetCoreServer/NetCoreServer.csproj | 2 +- www/api/openapi.yaml | 9 --------- 4 files changed, 4 insertions(+), 13 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 92757c9..2ec65df 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,5 +1,5 @@ # Specify version format -version: "5.0.0.{build}" +version: "5.0.1.{build}" # Image to use image: Visual Studio 2019 diff --git a/source/NetCoreServer/HttpRequest.cs b/source/NetCoreServer/HttpRequest.cs index ea3c8f7..56fb53e 100644 --- a/source/NetCoreServer/HttpRequest.cs +++ b/source/NetCoreServer/HttpRequest.cs @@ -800,8 +800,8 @@ internal bool ReceiveBody(byte[] buffer, int offset, int size) // Update body size _bodySize += size; - // GET request has no body - if ((Method == "HEAD") || (Method == "GET") || (Method == "OPTIONS") || (Method == "TRACE")) + // HEAD/GET/DELETE/OPTIONS/TRACE request might have no body + if ((Method == "HEAD") || (Method == "GET") || ((Method == "DELETE") && !_bodyLengthProvided) || (Method == "OPTIONS") || (Method == "TRACE")) { _bodyLength = 0; _bodySize = 0; diff --git a/source/NetCoreServer/NetCoreServer.csproj b/source/NetCoreServer/NetCoreServer.csproj index bc99e2b..86a713f 100644 --- a/source/NetCoreServer/NetCoreServer.csproj +++ b/source/NetCoreServer/NetCoreServer.csproj @@ -2,7 +2,7 @@ net5.0 - 5.0.0.0 + 5.0.1.0 Ivan Shynkarenka Copyright (c) 2019-2020 Ivan Shynkarenka https://github.com/chronoxor/NetCoreServer diff --git a/www/api/openapi.yaml b/www/api/openapi.yaml index 78bbf83..8b857fb 100644 --- a/www/api/openapi.yaml +++ b/www/api/openapi.yaml @@ -117,15 +117,6 @@ paths: schema: type: string example: 'test' - requestBody: - required: false - content: - application/json: - type: object - schema: - type: string - nullable: true - example: null responses: 200: description: Success