diff --git a/src/Titanium.Web.Proxy/Http/HttpWebClient.cs b/src/Titanium.Web.Proxy/Http/HttpWebClient.cs index 0ffcd4cc9..092728095 100644 --- a/src/Titanium.Web.Proxy/Http/HttpWebClient.cs +++ b/src/Titanium.Web.Proxy/Http/HttpWebClient.cs @@ -166,6 +166,8 @@ internal async Task ReceiveResponse(CancellationToken cancellationToken) return; } + Response.RequestMethod = Request.Method; + var httpStatus = await Connection.Stream.ReadResponseStatus(cancellationToken); Response.HttpVersion = httpStatus.Version; Response.StatusCode = httpStatus.StatusCode; diff --git a/src/Titanium.Web.Proxy/Http/Response.cs b/src/Titanium.Web.Proxy/Http/Response.cs index 80eb3ecd0..99c64dfef 100644 --- a/src/Titanium.Web.Proxy/Http/Response.cs +++ b/src/Titanium.Web.Proxy/Http/Response.cs @@ -36,6 +36,8 @@ public Response(byte[] body) /// public string StatusDescription { get; set; } = string.Empty; + internal string RequestMethod { get; set; } + /// /// Has response body? /// @@ -43,6 +45,11 @@ public override bool HasBody { get { + if (RequestMethod == "HEAD") + { + return false; + } + long contentLength = ContentLength; // If content length is set to 0 the response has no body