Skip to content

Conversation

@icewind1991
Copy link
Member

Signed-off-by: Robin Appelman [email protected]

@icewind1991 icewind1991 added the 3. to review Waiting for reviews label Apr 3, 2019
@icewind1991 icewind1991 added this to the Nextcloud 17 milestone Apr 3, 2019
Copy link
Member

@skjnldsv skjnldsv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 🤔

Copy link
Member

@skjnldsv skjnldsv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 :)

@MorrisJobke MorrisJobke mentioned this pull request Jul 15, 2019
28 tasks
@rullzer rullzer removed this from the Nextcloud 17 milestone Aug 15, 2019
@rullzer
Copy link
Member

rullzer commented Sep 15, 2019

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

@skjnldsv
Copy link
Member

Yeah, let's close I guess :)

@skjnldsv skjnldsv closed this Sep 16, 2019
@georgehrke georgehrke deleted the fetch-requesttoken branch September 16, 2019 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants