Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetch doesn’t support custom parameters #1005

Open
lmaddio opened this issue Nov 17, 2020 · 2 comments
Open

Fetch doesn’t support custom parameters #1005

lmaddio opened this issue Nov 17, 2020 · 2 comments

Comments

@lmaddio
Copy link

lmaddio commented Nov 17, 2020

I'm trying to fetch code from a third party library but I realised I can’t send a custom header.

fetch(config.domURL).then((response) => response.text()),
fetch(config.authorURL).then((response) => response.text()),

Could this be considered to be added in the future?

Also as a question, when I try to load a script from another domain it doesn’t execute and I assuming it has to do with a security policy.
As the sec-fetch-dest is being set as empty.
Do you know if this is related to be using fetch inside workers?

@samouri
Copy link
Member

samouri commented Nov 17, 2020

Have you tried passing headers in to the fetch call?

Something like:

fetch(someUrl, { 
  headers: {
      'Content-Type': 'application/json'
  }
)

@lmaddio
Copy link
Author

lmaddio commented Nov 17, 2020

@samouri yes, I tried and sec-fetch-dest remains empty.
Even the request is placed as XHR, not allowing the content to be executed.
Could you confirm if this happens to you as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants