Created
December 3, 2017 21:30
-
-
Save angelovstanton/b39712661e9cf18ba981dcda73ec6e77 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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