function parseCookies(response) {
const raw = response.headers.raw()['set-cookie'];
return raw.map((entry) => {
const parts = entry.split(';');
const cookiePart = parts[0];
return cookiePart;
}).join(';');
}
const loginCookies = parseCookies(loginRequest);
const reqOptions = {
'headers': {
'content-type': 'text/html; charset=utf-8',
'cookie': loginCookies,
},
'method': 'GET',
}
const newReq = await fetch('https://gmonitoring.com.ua/awp-sum/', reqOptions ).then(r => r.text())
{
headers: {
'content-type': 'text/html; charset=utf-8',
cookie: 'PHPSESSID=5n4cfn1er94n1u3ro1ge4c7p1s;PHPSESSID=5n4cfn1er94n1u3ro1ge4c7p1s'
},
method: 'GET'
}
Headers -> [Object: null prototype] {
date: [ 'Wed, 06 Oct 2021 15:16:32 GMT' ],
server: [ 'Apache/2.4.41 (Ubuntu)' ],
'set-cookie': [
'PHPSESSID=5n4cfn1er94n1u3ro1ge4c7p1s; path=/',
'PHPSESSID=5n4cfn1er94n1u3ro1ge4c7p1s; expires=Wed, 20-Oct-2021 15:16:32 GMT; Max-Age=1209600; path=/; secure; HttpOnly'
],
expires: [ 'Thu, 19 Nov 1981 08:52:00 GMT' ],
'cache-control': [ 'no-store, no-cache, must-revalidate' ],
pragma: [ 'no-cache' ],
'x-frame-options': [ 'SAMEORIGIN' ],
vary: [ 'X-Requested-With,Accept-Encoding' ],
'content-security-policy': [
"script-src 'self' 'unsafe-eval' 'unsafe-inline'; img-src 'self' data:"
],
'content-encoding': [ 'gzip' ],
'content-length': [ '2135' ],
connection: [ 'close' ],
'content-type': [ 'text/html; charset=utf-8' ]
}