This is a migrated thread and some comments may be shown as answers.

Change request body using script

1 Answer 219 Views
Fiddler Classic
This is a migrated thread and some comments may be shown as answers.
Peter84
Top achievements
Rank 1
Peter84 asked on 29 Nov 2019, 05:31 PM

Hello. I am changing the post request body through a script:

static function OnBeforeRequest(oSession: Session) {
        
        if (oSession.fullUrl=="https://www.example.com/api/v1/device") {
            var rep = System.IO.File.ReadAllBytes("replace.txt");  
            oSession.requestBodyBytes = rep;
        }

 

If I do not change the request body, the server accepts it (301). If I use a script, the server throws an error (401). The data in replace.txt is completely identical to the data from the original request that the server accepts. What could be the problem?

1 Answer, 1 is accepted

Sort by
0
Peter84
Top achievements
Rank 1
answered on 30 Nov 2019, 04:30 PM
The issue is resolved. It's not about Fiddler. MITMEngine is running on the server, which is why there is an error when replacing data.
Tags
Fiddler Classic
Asked by
Peter84
Top achievements
Rank 1
Answers by
Peter84
Top achievements
Rank 1
Share this question
or