Следующий код смог отправить запросы POST на внешний API
popup.js:
chrome.tabs.executeScript( {
code: "window.getSelection().toString();"
}, function(selection) {
//document.getElementById("output").innerHTML = selection[0];
var data = "quote=This%20is%20%dope%20feature%20with%20embed%20option";
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "http://localhost:8000/api/excerpt/");
xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded");
xhr.setRequestHeader("authorization", "Token 42f2909aeacc293ac3a33a76485821e6399d5e1472");
xhr.send(data);
});