Open thanggggg1 opened 3 months ago
@thanggggg1 Could you please explain the specific use case you're aiming to achieve so that we can provide more precise guidance?
@sudharsan-selvaraj i used addMock to block the request like this
const blockRequest = async (urlPattern) => { const mockId = await driver.execute('interceptor: addMock', { config: { url: urlPattern, statusCode: 403, // Block by returning 403 Forbidden responseBody: JSON.stringify({ message: 'Request blocked by interceptor', }), }, }); return mockId; };
but i want to get the original requestBody before block, can you show me how. Thank you so much
@thanggggg1 You can try below methods to get the API details
await driver.execute("interceptor: startListening");
await blockRequest();
// perform some action
// ...
const apiRequests = await driver.execute("interceptor: stopListening");
console.log(apiRequests) // This will have all the API calls made from the app with the actual response
Thank you @sudharsan-selvaraj , i will try
@sudharsan-selvaraj , i can not excecute when set up proxy
const capabilities = {
platformName: 'Android',
'appium:automationName': 'UiAutomator2',
'appium:deviceName': 'emulator-5554',
'appium:browserName': 'Chrome',
'appium:intercept': true,
'goog:chromeOptions': {
args: [
`--proxy-server=${proxy_host}`, // Your public proxy
'--ignore-certificate-errors'
]
}
};
Do you know how to fix this
I dont know how to get payload from POST request before update it