I’m a little new to Chrome Extension Development. The plan is to intercept response of a specific API call. I was able to filter the specific API call using chrome.webRequest
API. To be more specific, I am using chrome.webRequest.onCompleted
. Now the problem is I am unable to get the api response in the callback function of the event listener. Someone on the github pages suggested to add requestBody
in extraInfoSpec
. But now I’m getting error, the control never reaches in the callback function. Could you please help me understand what am I missing here?
chrome.webRequest.onCompleted.addListener(
async (details) => {
// console.log(details.url)
if (
details.url.indexOf('voyager/api/graphql') !== -1 &&
details.url.indexOf('profileUrn') !== -1
) {
console.log(details)
}
},
{
urls: ['*://www.example.com/*'], // changed it for the obvious reasons
},
['requestBody']
)
I tried a few things I found on the internet.
Expected: I need the API response in the event listener callback. I don’t want to use debugger
API, as it shows a warning. And that’s not a good UX.