Getting content of response on WebExtension devtools API
up vote
0
down vote
favorite
I'm trying to get the content of some background requests made while loading a website. I decided to use the devtools API, so I'm doing something like:
function handleRequestFinished(request)
request.getContent().then(content =>
// do something with content here
);
}
browser.devtools.network.onRequestFinished.addListener(handleRequestFinished);
Not exactly my code, but just a skeleton of how this is supposed to be done if we follow the docs1.
So what happens is, for some urls I get as content a list like [null, null]
. I suspect this is a bug or a permissions thing (maybe there are special permissions needed to get the content of a request if it is 3rd party/https/-add whatever arcane condition Mozilla considered here-).
I'm considering switching to webRequest, but in any case, if someone has a clue about what is happening here I would very much appreciate your help.
Update: Seems the problem is more related to big binary files. This API returns the base64 representation of binary files, and it seems that at some size it just stops returning anything. I've tried setting devtools.netmonitor.responseBodyLimit
with no luck.
PS: On the network tab, the content of those responses appears just fine.. The content on the network tab is truncated. Same as the content obtained through webRequest API. The only way to get the full response is by doing a curl...
firefox firefox-addon firefox-webextensions
add a comment |
up vote
0
down vote
favorite
I'm trying to get the content of some background requests made while loading a website. I decided to use the devtools API, so I'm doing something like:
function handleRequestFinished(request)
request.getContent().then(content =>
// do something with content here
);
}
browser.devtools.network.onRequestFinished.addListener(handleRequestFinished);
Not exactly my code, but just a skeleton of how this is supposed to be done if we follow the docs1.
So what happens is, for some urls I get as content a list like [null, null]
. I suspect this is a bug or a permissions thing (maybe there are special permissions needed to get the content of a request if it is 3rd party/https/-add whatever arcane condition Mozilla considered here-).
I'm considering switching to webRequest, but in any case, if someone has a clue about what is happening here I would very much appreciate your help.
Update: Seems the problem is more related to big binary files. This API returns the base64 representation of binary files, and it seems that at some size it just stops returning anything. I've tried setting devtools.netmonitor.responseBodyLimit
with no luck.
PS: On the network tab, the content of those responses appears just fine.. The content on the network tab is truncated. Same as the content obtained through webRequest API. The only way to get the full response is by doing a curl...
firefox firefox-addon firefox-webextensions
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm trying to get the content of some background requests made while loading a website. I decided to use the devtools API, so I'm doing something like:
function handleRequestFinished(request)
request.getContent().then(content =>
// do something with content here
);
}
browser.devtools.network.onRequestFinished.addListener(handleRequestFinished);
Not exactly my code, but just a skeleton of how this is supposed to be done if we follow the docs1.
So what happens is, for some urls I get as content a list like [null, null]
. I suspect this is a bug or a permissions thing (maybe there are special permissions needed to get the content of a request if it is 3rd party/https/-add whatever arcane condition Mozilla considered here-).
I'm considering switching to webRequest, but in any case, if someone has a clue about what is happening here I would very much appreciate your help.
Update: Seems the problem is more related to big binary files. This API returns the base64 representation of binary files, and it seems that at some size it just stops returning anything. I've tried setting devtools.netmonitor.responseBodyLimit
with no luck.
PS: On the network tab, the content of those responses appears just fine.. The content on the network tab is truncated. Same as the content obtained through webRequest API. The only way to get the full response is by doing a curl...
firefox firefox-addon firefox-webextensions
I'm trying to get the content of some background requests made while loading a website. I decided to use the devtools API, so I'm doing something like:
function handleRequestFinished(request)
request.getContent().then(content =>
// do something with content here
);
}
browser.devtools.network.onRequestFinished.addListener(handleRequestFinished);
Not exactly my code, but just a skeleton of how this is supposed to be done if we follow the docs1.
So what happens is, for some urls I get as content a list like [null, null]
. I suspect this is a bug or a permissions thing (maybe there are special permissions needed to get the content of a request if it is 3rd party/https/-add whatever arcane condition Mozilla considered here-).
I'm considering switching to webRequest, but in any case, if someone has a clue about what is happening here I would very much appreciate your help.
Update: Seems the problem is more related to big binary files. This API returns the base64 representation of binary files, and it seems that at some size it just stops returning anything. I've tried setting devtools.netmonitor.responseBodyLimit
with no luck.
PS: On the network tab, the content of those responses appears just fine.. The content on the network tab is truncated. Same as the content obtained through webRequest API. The only way to get the full response is by doing a curl...
firefox firefox-addon firefox-webextensions
firefox firefox-addon firefox-webextensions
edited Nov 12 at 9:10
asked Nov 10 at 20:08
dyeray
798312
798312
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53242979%2fgetting-content-of-response-on-webextension-devtools-api%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown