Closed jordanranson closed 6 years ago
Can you ensure token
is not undefined
? Aside from that, I'm not sure - this part of the behaviour is really relying on how the browser works and it shouldn't be wiping out any headers.
@blakeembrey I'm so sorry. I created a JSFiddle with the same code and was able to get the proper keys in the header. After investigating further I discovered that a misplaced parenthesis was causing the token to be passed in as undefined to my API call. User error, you were right on the money! Thanks for the help!
Hello, I'm having some trouble this morning with a multipart form upload. What I'm trying to do is upload some files to an API by passing a
FormData
object into the request as the body. Now, this works great until I try to add my own headers to the request. It seems any headers I add get completely ignored which is an issue because I need to pass a token in to authenticate the request.Here is the code I'm trying to use:
Here are the request headers that are sent:
You'll notice
token
is no where to be found.token
is present when I don't pass in aFormData
object as the body. Am I missing something?