I'm trying to test the example of the Titanium Proxy Server. However, after copying the example within the 'Read Me' section exactly, I am stuck with an error I can't resolve.
Within this method:
public async Task OnRequest(object sender, SessionEventArgs e)
{
Console.WriteLine(e.WebSession.Request.Url);
var requestHeaders = e.WebSession.Request.Headers;
var method = e.WebSession.Request.Method.ToUpper();
if ((method == "POST" || method == "PUT" || method == "PATCH"))
{
byte[] bodyBytes = await e.GetRequestBody();
await e.SetRequestBody(bodyBytes);
string bodyString = await e.GetRequestBodyAsString();
await e.SetRequestBodyString(bodyString);
e.UserData = e.WebSession.Request;
}
}
I am getting errors for the lines await e.SetRequestBodyString(bodyString);
and await e.SetRequestBody(bodyBytes);
.
There error message states Cannot await 'void'
and it is referring to the parameter within the method SessionEventArgs
as a void method itself.
How do I resolve this? Am I doing something wrong as the example code is specifically as written above?