I'm running the below fetch request on an array of items, they all fail expect the last one. It doesn't matter if the number of items are 10, 100, only the last item in an array will succeed in the fetch request.
var issns = ['09295666', '08989621', '02365294', '03643107', '02365294', '00015970', '03038173'];
issns.forEach((issn) => {
goFetchBoy(issn);
});
async function goFetchBoy(issn) {
var postresponse = await fetch('https://proquestFake.com/api/1-0-0/issnsearch', {
method: 'post',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
isxn: isxn,
resultsPerPage: 20,
}),
});
var data = await postresponse.json();
console.log(data);
}
Same code when tried in ChromeExtension>background script:
Same code when tried in Devtools>console.log :
As can be seen in the screenshot from devtools, the array has a value. Note: I also rewrote this code in Ajax.Jquery and had the exact same issue.