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

Specify MimeType to always use for ajax templates #742

Merged
merged 1 commit into from
Jun 14, 2020
Merged

Specify MimeType to always use for ajax templates #742

merged 1 commit into from
Jun 14, 2020

Conversation

MasterOdin
Copy link
Contributor

For twig.js to be used in the browser, it requires the user to know that they either must name their templates as an ending that browsers recognized (e.g. txt or html) or to manually register a mime-type to the .twig extension. Otherwise, when fetching a template, a browser will attempt to parse it using text/xml which can cause issues depending on strictness (e.g. #741).

This PR changes it so that twig.js always specifies that templates received via XMLHttpRequest are text/plain and to be treated as such.

@RobLoach RobLoach requested a review from PolyPik June 2, 2020 21:10
@RobLoach
Copy link
Collaborator

RobLoach commented Jun 2, 2020

This makes sense to me. I can't think of issuing any other mime type through this. Thoughts Poly?

@RobLoach RobLoach merged commit 26f9420 into twigjs:master Jun 14, 2020
@MasterOdin
Copy link
Contributor Author

Any chance on seeing this get into a release in the near term? As is, without manually setting the content type through apache / nginx, twig.js is broken for the latest Firefox users for us.

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

Successfully merging this pull request may close these issues.

2 participants