Hello, please tell me how to create a separate POST request using the C# language.
Initially, I tried to change the outgoing POST request from another application and resend it, but I get an error - "HTTP/1.1 504 Fiddler - Receive Failure".
And now you need to write a new request, specifying the headers and receiving a response.
And the whole question is how to do it all in C#?
I tried to use this code
public static void OnBeforeResponse(Session oSession)
{
if (oSession.HTTPMethodIs("POST") )
{
String strBody = oSession.GetRequestBodyAsString();
oSession.host="api.123.com";
string resultRequest = "request";
byte[] resulByte = System.Text.Encoding.ASCII.GetBytes(resultRequest);
FiddlerApplication.oProxy.SendRequest (oSession.RequestHeaders, resulByte, null);
}
The error 504 indicates that the request was received from the server but then was dropped for some reason, and no information was sent back. The reason might vary - it could be that the server expects a specific header or information or that the IP is not allowed (or other security techniques). There might also be a temporary issue with the server (server down or problematic connection).
Refer to this forum thread for other possible reasons and troubleshoot ideas related to this kind of error message.