Skip to content
This repository was archived by the owner on Jul 9, 2023. It is now read-only.

Commit 0bd4ec9

Browse files
authored
Merge pull request #699 from justcoding121/master
No body for head request (#695)
2 parents b3bbac3 + 9c2bc8b commit 0bd4ec9

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/Titanium.Web.Proxy/Http/HttpWebClient.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ internal async Task ReceiveResponse(CancellationToken cancellationToken)
166166
return;
167167
}
168168

169+
Response.RequestMethod = Request.Method;
170+
169171
var httpStatus = await Connection.Stream.ReadResponseStatus(cancellationToken);
170172
Response.HttpVersion = httpStatus.Version;
171173
Response.StatusCode = httpStatus.StatusCode;

src/Titanium.Web.Proxy/Http/Response.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,20 @@ public Response(byte[] body)
3636
/// </summary>
3737
public string StatusDescription { get; set; } = string.Empty;
3838

39+
internal string RequestMethod { get; set; }
40+
3941
/// <summary>
4042
/// Has response body?
4143
/// </summary>
4244
public override bool HasBody
4345
{
4446
get
4547
{
48+
if (RequestMethod == "HEAD")
49+
{
50+
return false;
51+
}
52+
4653
long contentLength = ContentLength;
4754

4855
// If content length is set to 0 the response has no body

0 commit comments

Comments
 (0)