Commit 6be0c005 authored by justcoding121's avatar justcoding121

remove async not needed in Respond call

parent 1af39dc1
...@@ -183,7 +183,7 @@ namespace Titanium.Web.Proxy.Examples.Basic ...@@ -183,7 +183,7 @@ namespace Titanium.Web.Proxy.Examples.Basic
//Filter URL //Filter URL
if (e.WebSession.Request.RequestUri.AbsoluteUri.Contains("yahoo.com")) if (e.WebSession.Request.RequestUri.AbsoluteUri.Contains("yahoo.com"))
{ {
await e.Ok("<!DOCTYPE html>" + e.Ok("<!DOCTYPE html>" +
"<html><body><h1>" + "<html><body><h1>" +
"Website Blocked" + "Website Blocked" +
"</h1>" + "</h1>" +
......
...@@ -531,7 +531,7 @@ namespace Titanium.Web.Proxy.EventArguments ...@@ -531,7 +531,7 @@ namespace Titanium.Web.Proxy.EventArguments
/// </summary> /// </summary>
/// <param name="html"></param> /// <param name="html"></param>
/// <param name="headers"></param> /// <param name="headers"></param>
public async Task Ok(string html, Dictionary<string, HttpHeader> headers = null) public void Ok(string html, Dictionary<string, HttpHeader> headers = null)
{ {
var response = new OkResponse(); var response = new OkResponse();
if (headers != null) if (headers != null)
...@@ -542,7 +542,7 @@ namespace Titanium.Web.Proxy.EventArguments ...@@ -542,7 +542,7 @@ namespace Titanium.Web.Proxy.EventArguments
response.HttpVersion = WebSession.Request.HttpVersion; response.HttpVersion = WebSession.Request.HttpVersion;
response.Body = response.Encoding.GetBytes(html ?? string.Empty); response.Body = response.Encoding.GetBytes(html ?? string.Empty);
await Respond(response); Respond(response);
} }
/// <summary> /// <summary>
...@@ -552,14 +552,14 @@ namespace Titanium.Web.Proxy.EventArguments ...@@ -552,14 +552,14 @@ namespace Titanium.Web.Proxy.EventArguments
/// </summary> /// </summary>
/// <param name="result"></param> /// <param name="result"></param>
/// <param name="headers"></param> /// <param name="headers"></param>
public async Task Ok(byte[] result, Dictionary<string, HttpHeader> headers = null) public void Ok(byte[] result, Dictionary<string, HttpHeader> headers = null)
{ {
var response = new OkResponse(); var response = new OkResponse();
response.Headers.AddHeaders(headers); response.Headers.AddHeaders(headers);
response.HttpVersion = WebSession.Request.HttpVersion; response.HttpVersion = WebSession.Request.HttpVersion;
response.Body = result; response.Body = result;
await Respond(response); Respond(response);
} }
/// <summary> /// <summary>
...@@ -572,14 +572,14 @@ namespace Titanium.Web.Proxy.EventArguments ...@@ -572,14 +572,14 @@ namespace Titanium.Web.Proxy.EventArguments
/// <param name="status"></param> /// <param name="status"></param>
/// <param name="headers"></param> /// <param name="headers"></param>
/// <returns></returns> /// <returns></returns>
public async Task GenericResponse(string html, HttpStatusCode status, Dictionary<string, HttpHeader> headers = null) public void GenericResponse(string html, HttpStatusCode status, Dictionary<string, HttpHeader> headers = null)
{ {
var response = new GenericResponse(status); var response = new GenericResponse(status);
response.HttpVersion = WebSession.Request.HttpVersion; response.HttpVersion = WebSession.Request.HttpVersion;
response.Headers.AddHeaders(headers); response.Headers.AddHeaders(headers);
response.Body = response.Encoding.GetBytes(html ?? string.Empty); response.Body = response.Encoding.GetBytes(html ?? string.Empty);
await Respond(response); Respond(response);
} }
/// <summary> /// <summary>
...@@ -592,14 +592,14 @@ namespace Titanium.Web.Proxy.EventArguments ...@@ -592,14 +592,14 @@ namespace Titanium.Web.Proxy.EventArguments
/// <param name="status"></param> /// <param name="status"></param>
/// <param name="headers"></param> /// <param name="headers"></param>
/// <returns></returns> /// <returns></returns>
public async Task GenericResponse(byte[] result, HttpStatusCode status, Dictionary<string, HttpHeader> headers) public void GenericResponse(byte[] result, HttpStatusCode status, Dictionary<string, HttpHeader> headers)
{ {
var response = new GenericResponse(status); var response = new GenericResponse(status);
response.HttpVersion = WebSession.Request.HttpVersion; response.HttpVersion = WebSession.Request.HttpVersion;
response.Headers.AddHeaders(headers); response.Headers.AddHeaders(headers);
response.Body = result; response.Body = result;
await Respond(response); Respond(response);
} }
/// <summary> /// <summary>
...@@ -607,18 +607,18 @@ namespace Titanium.Web.Proxy.EventArguments ...@@ -607,18 +607,18 @@ namespace Titanium.Web.Proxy.EventArguments
/// </summary> /// </summary>
/// <param name="url"></param> /// <param name="url"></param>
/// <returns></returns> /// <returns></returns>
public async Task Redirect(string url) public void Redirect(string url)
{ {
var response = new RedirectResponse(); var response = new RedirectResponse();
response.HttpVersion = WebSession.Request.HttpVersion; response.HttpVersion = WebSession.Request.HttpVersion;
response.Headers.AddHeader(KnownHeaders.Location, url); response.Headers.AddHeader(KnownHeaders.Location, url);
response.Body = emptyData; response.Body = emptyData;
await Respond(response); Respond(response);
} }
/// a generic responder method /// a generic responder method
public async Task Respond(Response response) public void Respond(Response response)
{ {
if (WebSession.Request.RequestLocked) if (WebSession.Request.RequestLocked)
{ {
......
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