Reputation: 543
I'm passing the body parameters this way:
body: JSON.stringify(parameters),
where parameters
is structured like parameters.name = 'name'
, ...
I would like to accomplish the same with the headers but the key (of the key/value) contains -
.
headers: {
'X-Public-App-Authentication': 'Token ' + token,
'content-type': 'application/json'
},
how can I pass this header as a parameter so I can just write headers: JSON.stringify(heads),
?
Upvotes: 0
Views: 1160
Reputation: 28539
The following are the same parameters.name
and parameters['name']
So you could do the following
headers['X-Public-App-Authentication'] = 'Token ' + token
Upvotes: 1