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

Commit

Permalink
Merge pull request #699 from justcoding121/master
Browse files Browse the repository at this point in the history
No body for head request (#695)
  • Loading branch information
honfika authored Dec 10, 2019
2 parents b3bbac3 + 9c2bc8b commit 0bd4ec9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Titanium.Web.Proxy/Http/HttpWebClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 7 additions & 0 deletions src/Titanium.Web.Proxy/Http/Response.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,20 @@ public Response(byte[] body)
/// </summary>
public string StatusDescription { get; set; } = string.Empty;

internal string RequestMethod { get; set; }

/// <summary>
/// Has response body?
/// </summary>
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
Expand Down

0 comments on commit 0bd4ec9

Please sign in to comment.