gpt4 book ai didi

Javascript - Chrome 扩展 - Webrequest - Responsebody

转载 作者:行者123 更新时间:2023-11-29 14:41:03 25 4
gpt4 key购买 nike

我想为 Chrome 编写一个扩展来观看我的 XHR 调用,我发现我必须为此使用 webRequest。

我想获取请求的响应主体,但我一直找不到如何执行此操作。这可能吗?

// chrome.browserAction.onClicked.addListener(function (tab) {
var callback = function(details) {
var url = details.url;

console.log(details);
};

var filter = {
urls: ["*://safan.dev/*"]
};

var ops = ["requestBody"];

chrome.webRequest.onBeforeRequest.addListener(
callback, filter, ops
);
// });

和 list :

{
"manifest_version": 2,

"name": "Forge of Empires",
"description": "FOE",
"version": "1.0",

"browser_action": {
"default_icon": "icon.png"
},
"permissions": [
"webRequest",
"<all_urls>"
],
"background": {
"scripts": ["logic.js"]
}
}

最佳答案

I want to get the response-body of the request but i never can find how to do this. Is this possible?

暂时没有。有一个 long-standing feature request .


请注意,您可以使用 devtools.network API 来完成此操作(需要打开开发工具)或 Debugger API (需要关闭开发工具,低级别)。

关于Javascript - Chrome 扩展 - Webrequest - Responsebody,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38221405/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com