Closed ben-codes-five closed 4 months ago
however, I am trying to modify the response for an endpoint using scripts but the scripts aren't being triggered.
If you don't see any log, it means the Script URL doesn't match your URL.
Can you show me the script URL Rule you're using?
Your script is an old way to match with a GraphQL Query Name. If you're using v5.0.0, there is an easier way:
const file = require("mockdata.json");
async function onResponse(context, url, request, response) {
response.headers["Content-Type"] = "application/json";
response.body = file;
// Done
return response;
}
Or you can map to a local file directly:
async function onResponse(context, url, request, response) {
// console.log(response);
response.headers["Content-Type"] = "application/json";
response.bodyFilePath = "~/Desktop/my_response.json"
// Done
return response;
}
I was able to get it to work! However, not by importing my json file. I had to map the local file directly. Thanks for your help!
@ben-codes-five Glad to know you made it. The Map Local Tool works fine too 👍
Reopening because a colleague of mine is having the same issue but can't seem to figure out what the issue is.
Similar to @ben-codes-five I'm unable to execute my script through requests made from simulator. Only on repeat requests through the proxyman window can I get the script to run. Heres my match:
@jmittelstaedt12 can you follow this steps:
console.log()
from the Scripting ?May I ask: Is your iOS app a native iOS app or React-Native ?
Here is the video: It works fine.
https://github.com/ProxymanApp/Proxyman/assets/5878421/93e79918-4189-4815-b846-56797721f4b8
@NghiaTranUIT resolved the issue. My problem seemed to be that I had my VPN on, as its now working with it turned off
Description
I am doing iOS development and monitoring network traffic using Proxyman. I can see the network calls in Proxyman, suggesting I have the certificates set up correctly, however, I am trying to modify the response for an endpoint using scripts but the scripts aren't being triggered.
For context, the endpoint is a graphql endpoint and below is my script:
I can confirm the script works because I am able to trigger the script by rerunning the request within Proxyman, however, I am unable to trigger the script from sending a request from my iOS app.
Any idea what the issue is? Smells like either an internal bug or a configuration issue.
Environment