'How to filter out POST requests in fiddler by Body?
Using Fiddler.
Im listening only traffic from eg
superhost.org
which is added to my filters (eg via "Show only if URL contains").
Traffic consists of similar POST requests, which could be different only by Body. Example:
First request:
{
"param 1" : "1"
"param 2" : "2"
}
Second request:
{
"param 1" : "1"
"param 2" : "3"
}
All headers etc same, only body differs.
Question: How i can listen(simply saying - see in Requests list in Fiddler) for only requests, which has "param 2" : "3" in body. (So, in our fakeExample, Request1 should be filtered out, and only Request2 should be listened by Fiddler)
Solution 1:[1]
You can do that using Fiddler.Script, that reads the body, checks if it contains the string and if it finds the string hides the complete request/response:
static function OnBeforeRequest(oSession: Session) {
if (oSession.HostnameIs("superhost.org")) {
var body = oSession.GetRequestBodyAsString();
if (!body.Contains("\"param 2\" : \"3\"")) {
oSession["ui-hide"] = "does not have search string";
}
}
}
For an more advanced version you could check the path and/or content-type of the request before and then parse it to JSON so that formatting changes do not affect the recognition of the value you are searching.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | EricLaw |