set request tokens on request made using fetch#14943
set request tokens on request made using fetch#14943icewind1991 wants to merge 1 commit intomasterfrom
Conversation
Signed-off-by: Robin Appelman <robin@icewind.nl>
There was a problem hiding this comment.
Headers are not a simple object. It's a constructor:
https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch#Headers
https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch#Supplying_request_options
myHeaders = new Headers({
"Content-Length": content.length.toString(),
"X-Custom-Header": "ProcessThisImmediately",
});
myHeaders.append("Content-Type", "text/plain");
var myInit = { method: 'GET',
headers: myHeaders,
mode: 'cors',
cache: 'default' };
fetch('flowers.jpg', myInit)I don't know if forcing it to be an object like your implementation can lead to issues or not 🤔
There was a problem hiding this comment.
I'll also add that it's not available everywhere
https://caniuse.com/#feat=fetch
So like this it will initiate and create window.fetch even if fetch is not available, which can cause issues if any other software want to check if the browsers supports native fetch :)
|
we do not use fetch anywhere I think. And we don't (or will soon no longer) ship babel polyfill. So i'm not sure this is needed or useful? @ChristophWurst @skjnldsv |
|
Yeah, let's close I guess :) |
Signed-off-by: Robin Appelman robin@icewind.nl