Skip to content

clarify : how to pass arguments to new Headers.append .set #1427

Answered by jimmywarting
tst32 asked this question in Q&A
Discussion options

You must be logged in to vote

The Headers constructor takes either a 2D array or an object, not a flat array...

new Headers([
  ['referer', 'somesite.com'],
  ['content-type': 'text/plain'],
  ['key1', 'value1']
])

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by jimmywarting
Comment options

You must be logged in to vote
1 reply
@jimmywarting
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants
Converted from issue

This discussion was converted from issue #1426 on December 21, 2021 15:29.