Skip to content

set request tokens on request made using fetch - #14943

Closed
icewind1991 wants to merge 1 commit into
masterfrom
fetch-requesttoken
Closed

set request tokens on request made using fetch#14943
icewind1991 wants to merge 1 commit into
masterfrom
fetch-requesttoken

Conversation

@icewind1991

Copy link
Copy Markdown
Member

Signed-off-by: Robin Appelman robin@icewind.nl

Signed-off-by: Robin Appelman <robin@icewind.nl>
@icewind1991icewind1991 added the 3. to review Waiting for reviews label Apr 3, 2019
@icewind1991icewind1991 added this to the Nextcloud 17 milestone Apr 3, 2019

@skjnldsvskjnldsv left a comment

Copy link
Copy Markdown
Member

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=newHeaders({"Content-Length": content.length.toString(),"X-Custom-Header": "ProcessThisImmediately",});myHeaders.append("Content-Type","text/plain");varmyInit={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 🤔

@skjnldsvskjnldsv left a comment

Copy link
Copy Markdown
Member

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

@MorrisJobkeMorrisJobke mentioned this pull request Jul 15, 2019
28 tasks
@rullzerrullzer removed this from the Nextcloud 17 milestone Aug 15, 2019
@rullzer

Copy link
Copy Markdown
Member

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
Copy Markdown
Member

Yeah, let's close I guess :)

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

Labels

3. to reviewWaiting for reviews

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@icewind1991@rullzer@skjnldsv@ChristophWurst