Skip to content

Instantly share code, notes, and snippets.

@antelle
Last active July 5, 2023 22:32
Show Gist options
  • Save antelle/5bf48f0e7226dd8f60ed to your computer and use it in GitHub Desktop.
Save antelle/5bf48f0e7226dd8f60ed 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');
}
}
@markdon
Copy link

markdon commented Mar 2, 2018

Thanks for posting this! I was struggling without knowing about oSession.utilSetResponseBody

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment