0

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), ?

1 Answer 1

1

The following are the same parameters.name and parameters['name']

So you could do the following

headers['X-Public-App-Authentication'] = 'Token ' + token

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.