Answer the question
In order to leave comments, you need to log in
How to change FormData?
How to change FormData? I have a request interception, I just have to change a little FormData. But after reading all the Google and Yandex, I did not find anything specific.
chrome.webRequest.onBeforeRequest.addListener(
function(details) {
/*let formData = details.requestBody.formData;
if(formData) {
Object.keys(formData).forEach(key => {
formData[key].forEach(value => {
if(key.includes("name")) {
formData.name = "John";
alert(formData)
}
details.requestBody.formData = formData;
});
});
}*/
return {cancel: true};
//await ev(details)
},
{urls: ["*://vk.com/al_im.php?*=*a_send"]},
["requestBody", "blocking"]
);
Answer the question
In order to leave comments, you need to log in
This is done through the content script. Using the content script, inject your code onto the VK and then intercept POST requests through the inserted script, if necessary, change it.
PS I'm just not sure that chrome.webRequest.onBeforeRequest allows you to edit the request body, check the documentation - most likely it doesn't.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question