Skip to content

Add fetch support in Ajax #863

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

Open
fuzhenn opened this issue Feb 21, 2019 · 6 comments
Open

Add fetch support in Ajax #863

fuzhenn opened this issue Feb 21, 2019 · 6 comments

Comments

@fuzhenn
Copy link
Member

fuzhenn commented Feb 21, 2019

Add support of fetch in Ajax.js if it's available.

XHR missed referer header in HTTP request, fetch can fix this issue.

@nik72619c
Copy link

Could you provide the part where it has to be added?

@fuzhenn
Copy link
Member Author

fuzhenn commented Mar 4, 2019

https://github.com/maptalks/maptalks.js/blob/master/src/core/Ajax.js

The fetch support should be smooth and transparent, my thoughts here:

  • important to leave methods in Ajax.js unchanged.
  • detect fetch support in Browser.js
  • switch to fetch if browser supports.
  • fall back to xhr if browser doesn't support.

@nik72619c
Copy link

Cool...gonna work on this

@nik72619c
Copy link

@fuzhenn I guess Browser doesn't use fetch call...could you provide me with the line where the XMLHttpRequest is used?

@nik72619c
Copy link

What I think is functions like getClient need to be checked for browser support I am not wrong

@fuzhenn
Copy link
Member Author

fuzhenn commented Mar 6, 2019

Yes, you are right.
We can ignore Browser.js, and do all the things in Ajax.js.

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

No branches or pull requests

2 participants