Skip to content

Instantly share code, notes, and snippets.

@stesee
Forked from antelle/FiddlerScript.cs
Created May 10, 2021 04:49
Show Gist options
  • Save stesee/2a1320773e69bdb1d9f4f2dfa2ee73af to your computer and use it in GitHub Desktop.
Save stesee/2a1320773e69bdb1d9f4f2dfa2ee73af to your computer and use it in GitHub Desktop.
Change response in Fiddler
static function OnBeforeRequest(oSession: Session) {
if (oSession.RequestMethod == 'GET' && oSession.PathAndQuery.IndexOf('part_of_your_url') > 0) {
oSession.utilCreateResponseAndBypassServer();
oSession.oResponse.headers.HTTPResponseCode = 401;
oSession.oResponse.headers.HTTPResponseStatus = '401 Not Authorized';
oSession.oResponse.headers['Access-Control-Allow-Origin'] = '*';
oSession.utilSetResponseBody('response_body');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment