Skip to content

Instantly share code, notes, and snippets.

@angelovstanton
Created December 3, 2017 21:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save angelovstanton/b39712661e9cf18ba981dcda73ec6e77 to your computer and use it in GitHub Desktop.
Save angelovstanton/b39712661e9cf18ba981dcda73ec6e77 to your computer and use it in GitHub Desktop.
private async Task OnRequestModifyTrafficEventHandler(object sender, SessionEventArgs e)
{
var method = e.WebSession.Request.Method.ToUpper();
if ((method == "POST" || method == "PUT" || method == "PATCH" || method == "GET"))
{
//Get/Set request body bytes
byte[] bodyBytes = await e.GetRequestBody();
await e.SetRequestBody(bodyBytes);
//Get/Set request body as string
string bodyString = await e.GetRequestBodyAsString();
await e.SetRequestBodyString(bodyString);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment