gentle-accountant-4760
07/04/2022, 10:12 AMts
const requestUrl = `${constants.baseUrl.api}/hello/world/User/${userID}`.trim();
const pathToSign = Helper.getPathToSign(requestUrl);
const timeStamp = Helper.formatDateISOBasic(new Date());
const headers = [
{ name: 'override', value: 'yes' },
{ name: 'keylord', value: '12345' },
{ name: 'environment', value: 'thrill' },
{ name: 'timestamp', value: timeStamp },
];
const headerArray = {};
Object.entries(headers).forEach(([, header]) => { headerArray[header.name] = header.value; });
const signer = new MessageSigner();
const signature = signer.getSignature('barrythrill', pathToSign, headers, []);
cy.request({
url: requestUrl,
method: 'GET',
headers: {
...headerArray,
'signature': signature,
},
failOnStatusCode: false,
log: true,
})
.then((response) => {
cy.log('resp', JSON.stringify(response));
});
});
and I would like to get the response to do some except tests. I wonder where should I put such a code as? Function in pageobject, command or ...?