Commit ef38da77 authored by Honfika's avatar Honfika

allow to set custom response body on redirect

parent 9c3a4f25
......@@ -173,7 +173,7 @@ namespace Titanium.Web.Proxy.Http
internal byte[] CompressBodyAndUpdateContentLength()
{
if (!IsBodyRead)
if (!IsBodyRead && BodyInternal == null)
{
return null;
}
......
......@@ -128,6 +128,21 @@ namespace Titanium.Web.Proxy.Http
}
}
/// <summary>
/// Constructor.
/// </summary>
public Response()
{
}
/// <summary>
/// Constructor.
/// </summary>
public Response(byte[] body)
{
Body = body;
}
internal static string CreateResponseLine(Version version, int statusCode, string statusDescription)
{
return $"HTTP/{version.Major}.{version.Minor} {statusCode} {statusDescription}";
......
......@@ -15,5 +15,13 @@ namespace Titanium.Web.Proxy.Http.Responses
StatusCode = (int)HttpStatusCode.OK;
StatusDescription = "OK";
}
/// <summary>
/// Constructor.
/// </summary>
public OkResponse(byte[] body) : this()
{
Body = body;
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment