@dovid אמר בNODEJS איחזור נתונים מתוך node-fetch:
צודק טעיתי, צריך לעשות את זה אחרת, מסובך טיפה:
fetch('https://httpbin.org/post', { method: 'POST', body: 'a=1' })
.then(res => Promise.all([res.json(), res.headers.get('content-type')]))
.then(arr => {
console.log(arr[0]);
console.log(arr[1]);
});
אבל לדעתי יותר אלגנטי להשתמש עם אובייקט.
כך זה עובד, רק למה לא הולך לעשות את זה סתם כמערך, למשל:
fetch('https://httpbin.org/post', { method: 'POST', body: 'a=1' })
.then(res => [res.json(), res.headers.get('content-type')])
.then(arr => {
console.log(arr[0]);
console.log(arr[1]);
});