Skip to content

Instantly share code, notes, and snippets.

@NghiaTranUIT
Created October 23, 2020 06:03
Show Gist options
  • Save NghiaTranUIT/979e3cb658291b882cc0cce219e25f94 to your computer and use it in GitHub Desktop.
Save NghiaTranUIT/979e3cb658291b882cc0cce219e25f94 to your computer and use it in GitHub Desktop.
Combine Map Local and Breakpoint with Scripting feature - Proxyman (https://proxyman.io)
// /Users/nghiatran/Library/Application Support/com.proxyman.NSProxy/users/D6B9C80C.default_message_683CE65F.json
const file = require("@users/D6B9C80C.default_message_683CE65F.json");
function onRequest(context, url, request) {
// Done
return request;
}
function onResponse(context, url, request, response) {
// Change name of the local file
file.name = "Proxyman"
// Add custom header
response.headers["x-key"] = "Proxyman"
// Map again
response.body = file
// Done
return response;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment