Commit 30f5961a authored by KevinRMCD's avatar KevinRMCD Committed by GitHub

Update SessionEventArgs.cs

parent a1d3d479
...@@ -419,44 +419,45 @@ namespace Titanium.Web.Proxy.EventArguments ...@@ -419,44 +419,45 @@ namespace Titanium.Web.Proxy.EventArguments
WebSession.Request.CancelRequest = true; WebSession.Request.CancelRequest = true;
} }
public async Task GenericResponse(string html, HttpStatusCode status)         public async Task GenericResponse(string html, HttpStatusCode status)       
        { {
            await GenericResponse(html, null, status);             await GenericResponse(html, null, status);
        } }
        public async Task GenericResponse(string html, Dictionary<string, HttpHeader> headers, HttpStatusCode status)         public async Task GenericResponse(string html, Dictionary<string, HttpHeader> headers, HttpStatusCode status)
        { {           
            if (WebSession.Request.RequestLocked) if (WebSession.Request.RequestLocked)           
            { {               
                throw new Exception("You cannot call this function after request is made to server."); throw new Exception("You cannot call this function after request is made to server.");           
            } }
       
            if (html == null)
            {
                html = string.Empty;
            }
            var result = Encoding.Default.GetBytes(html); if (html == null)
{               
html = string.Empty;           
}
            await GenericResponse(result, headers, status); var result = Encoding.Default.GetBytes(html);
        }
        public async Task GenericResponse(byte[] result, Dictionary<string, HttpHeader> headers, HttpStatusCode status) await GenericResponse(result, headers, status);       
        { }
            var response = new GenericResponse(status);
            if (headers != null && headers.Count > 0) public async Task GenericResponse(byte[] result, Dictionary<string, HttpHeader> headers, HttpStatusCode status)
            { {
                response.ResponseHeaders = headers; var response = new GenericResponse(status);
            }
            response.HttpVersion = WebSession.Request.HttpVersion; if (headers != null && headers.Count > 0)
            response.ResponseBody = result; {
response.ResponseHeaders = headers;
}
            await Respond(response); response.HttpVersion = WebSession.Request.HttpVersion;
response.ResponseBody = result;
            WebSession.Request.CancelRequest = true; await Respond(response);
        }
WebSession.Request.CancelRequest = true;
}
public async Task Redirect(string url) public async Task Redirect(string url)
{ {
......
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