How to fake an http message?

I am using asp.net mvc and I want to fake an http message to find out what will happen. Is there any software that I can use?

+3
source share
6 answers

I believe Fiddler allows you to do this, as well as much more.

I use it only to check what happens to the server when dealing with headaches caused by AJAX, but I'm sure you can use it to re-issue HTTP requests since they were originally and changed, which should fit the bill for you .

+7
source
string var1 = "Foo";
string var2 = "Bar";

ASCIIEncoding encoding = new ASCIIEncoding();
string post = "var1=" + var1 + "&var2=" + var2;
byte[] bites = encoding.GetBytes(post);

HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://Url/PageToPostTo.aspx");
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = bites.Length;
Stream s = request.GetRequestStream();
s.Write(bites, 0, bites.Length);
s.Close();
+2
source

TamperData, Firefox.

+1

javascript:

function makeRequest(message,url,responseFunction){
var http_request;
    if (window.XMLHttpRequest){ // Mozilla, Safari,...
    http_request = new XMLHttpRequest();
    if (http_request.overrideMimeType) {
        // set type accordingly to anticipated content type
        //http_request.overrideMimeType('text/xml');
        http_request.overrideMimeType('text/html');
    }
}
else if (window.ActiveXObject){ // IE
    try {
        http_request = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e){
        try {
            http_request = new ActiveXObject("Microsoft.XMLHTTP");
        } catch (e) {}
    }
}

http_request.onreadystatechange = responseFunction;
    http_request.open("POST", url);
http_request.setRequestHeader("Content-Type", "text/plain;charset=UTF-8");
http_request.send(message);
}
0

Charles HTTP- / . , .

0
source

The next open source project allows you to fake external web services in your acceptance tests.

It supports the common HTTP verbs GET, POST, DELETE, and PUT;

http://www.nuget.org/packages/boomerang/ https://github.com/garfieldmoore/Boomerang

0
source

Source: https://habr.com/ru/post/1759223/


All Articles