I'm trying to read some data from the incoming requests inside a chrome extension. Wierd issue is that in case of a POST request I get data from the body, but when reading it from PATCH it's always undefined.
Checked both requests in the network tab in dev tools and there both requests have something in the body.
const handleResponse = (details: chrome.webRequest.WebRequestBodyDetails): void | chrome.webRequest.BlockingResponse => {
switch (details.method) {
case "POST":
case "PATCH":
console.log(details.requestBody);
break;
}
}
chrome.webRequest.onBeforeRequest.addListener(
handleResponse,
{ urls: ["*://*.dynamics.com/api/data/v*"] },
['requestBody']
);
I have these premissions defined in the manifest.
"permissions": [
"storage",
"tabs",
"webRequest",
"sidePanel"
]
Is there a documented issue with PATCH requests?
As they say in this thread, it's a known issue, and as I can see it's been active for a while now.
https://issues.chromium.org/issues/40130515
Only PUT and POST messages will have requestBody in the details object.