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

Update SessionEventArgs.cs

parent a1d3d479
...@@ -419,45 +419,46 @@ namespace Titanium.Web.Proxy.EventArguments ...@@ -419,45 +419,46 @@ 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) if (html == null)
            { {               
                html = string.Empty; html = string.Empty;           
            } }
            var result = Encoding.Default.GetBytes(html); var result = Encoding.Default.GetBytes(html);
            await GenericResponse(result, headers, status); await GenericResponse(result, headers, status);       
        } }
        public async Task GenericResponse(byte[] result, Dictionary<string, HttpHeader> headers, HttpStatusCode status) public async Task GenericResponse(byte[] result, Dictionary<string, HttpHeader> headers, HttpStatusCode status)
        { {
            var response = new GenericResponse(status); var response = new GenericResponse(status);
            if (headers != null && headers.Count > 0) if (headers != null && headers.Count > 0)
            { {
                response.ResponseHeaders = headers; response.ResponseHeaders = headers;
            } }
            response.HttpVersion = WebSession.Request.HttpVersion; response.HttpVersion = WebSession.Request.HttpVersion;
            response.ResponseBody = result;
response.ResponseBody = result;
            await Respond(response);
await Respond(response);
            WebSession.Request.CancelRequest = true;
        } WebSession.Request.CancelRequest = true;
}
public async Task Redirect(string url) public async Task Redirect(string url)
{ {
var response = new RedirectResponse(); var response = new RedirectResponse();
......
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