We have that piece of code on multiple locations:
if (this.debug) {
cmd.log('Executing web request...');
cmd.log(requestOptions);
cmd.log('');
}
But whenever requestOptions has headers specified like:
const requestOptions: any = {
...
headers: Utils.getRequestHeaders({
authorization: `Bearer ${accessToken}`,
accept: 'application/json;odata=nometadata'
})
};
then the output for the headers section when we specify --debug is
Executing web request...
url : https://xxx.sharepoint.com/sites/xxx/_api/contextinfo
headers: [object Object]
json : true
This can be changed to
if (this.debug) {
cmd.log('Executing web request...');
cmd.log(JSON.stringify(requestOptions));
cmd.log('');
}
to print the correct output.
I did not wanted to change it before discussion because it has 24 occurrences in the solution.
We have that piece of code on multiple locations:
But whenever
requestOptionshas headers specified like:then the output for the headers section when we specify --debug is
This can be changed to
to print the correct output.
I did not wanted to change it before discussion because it has 24 occurrences in the solution.