GraphQL uses the same URL to query different responses from the server, current debugging tools (e.g. Map Local, Breakpoint, Map Remote) doesn't work well.
However, by using the Scripting Tool, we can easily achieve:
Map Local for the response depends on QueryName
Manipulate the query, body, header for GraphQL Requests and Response
We can use the Scripting tool to map
Open Proxyman
Enable SSL Proxying on the GraphQL domain
Verify that you can see HTTPS requests from your domain
Right-Click on the flow -> Tool -> Scripting to create a script with the given URL
To import a local file: Click the More button -> Import JSON or Other files -> Then selecting your file
Use the following script shows you how to set a Local File to a GraphQL request with QueryName="user"
// Import file from More Button -> Import JSON or Other filesconst file = require("@users/B02D96D5.default_message_32E64A5B.json");​function onRequest(context, url, request) {​// 1. Extract the queryName from the requestvar queryName = request.body.query.match(/\S+/gi)[1].split('(').shift();​// 2. Save to sharedStatesharedState.queryName = queryName​// Donereturn request;}​function onResponse(context, url, request, response) {​// 3. Check if it's the request we need to mapif (sharedState.queryName == "user") {// 4. Import the local file by Action Button -> Import// Get the local JSON file and set it as a body (like Map Local)response.headers["Content-Type"] = "application/json";response.body = file;}​// Donereturn response;}
Use the same code and change the queryName
Please use the snipped code to change the values