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

Improve content type detection #1264

Closed
ameshkov opened this issue Aug 30, 2016 · 0 comments

Comments

@ameshkov
Copy link
Member

commented Aug 30, 2016

For some browsers (for instance, for Chromium and FF) we could use "Accept" header to detect request content type.

For instance, here is an image loading with <img> tag:
Accept: image/webp,image/*,*/*;q=0.8

Does not work <script> tags.

Works for <link> in case if type is specified:
Accept:text/css,*/*;q=0.1

Document:
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8

We can use Origin header as marker for xmlhttprequest.

If Accept starts with application/json, it is most likely XHR as well:
application/json, text/javascript, */*; q=0.01

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.