-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Labels
exampleNew or updated exampleNew or updated exampleidleIssues and pull requests with no activity for three months.Issues and pull requests with no activity for three months.
Description
https://github.com/mdn/webextensions-examples/tree/master/http-response
code :
function listener(details) {
var filter = browser.webRequest.filterResponseData(details.requestId);
var decoder = new TextDecoder("utf-8");
var encoder = new TextEncoder();
filter.ondata = event => {
var str = decoder.decode(event.data, {stream: true});
console.log( str.length, str);
filter.write(encoder.encode(str));
filter.disconnect();
}
return {};
}
browser.webRequest.onBeforeRequest.addListener(
listener,
{urls: ["<all_urls>"], types: ["xmlhttprequest"]},
["blocking"]
);
console.log( str.length, str);
sometimes, the str is fragmentary .
for example,like this pic:
"alig" it's not the end of response ,but it's end...
Metadata
Metadata
Assignees
Labels
exampleNew or updated exampleNew or updated exampleidleIssues and pull requests with no activity for three months.Issues and pull requests with no activity for three months.