че то ты явно не так делаешь. код в студию
///ext.js
chrome.runtime.sendMessage({contentScriptQuery: 'getNamespace', env: env},
resp => {
console.log('=--');
console.log(resp);
console.log('=--');
}
)
/*
///console
=---
{error: true, data: {}, env: dev}
=--
*/
///background.js
chrome.runtime.onMessage.addListener(
function(request, sender, sendResponse) {
if (request.contentScriptQuery == "getNamespace") {
const url = http://dashboard.${request.env}.o.ru/api/v1/namespace
;
const resp = fetch(url)
.then(resp => sendResponse(resp))
.catch(err => sendResponse({error: true, data: err, env: request.env}));
return true;
}
});