I'm attempting to append multiple header values. This is what I'm currently doing:
options.headers.append('Content-Type', 'application/json');
options.headers.append('X-Requested-By', 'api-client');
... and so on,
Instead of listing each value separately, is there a way we can consolidate them like this:
let headers = {
'Content-Type': 'application/json',
'X-Requested-By': 'api-client',
... and so on,
}
options.headers.append(headers);
Are there any other methods that could be used?