This repository was archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix($templateRequest): Set Accept
header on template requests
#11868
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set the `Accept` header on HTTP requests for templates to `text/html, text/ng-template`. Previously the default request headers sent by `$http` were used. Closes angular#6860
@@ -36,7 +36,8 @@ function $TemplateRequestProvider() { | |||
|
|||
var httpOptions = { | |||
cache: $templateCache, | |||
transformResponse: transformResponse | |||
transformResponse: transformResponse, | |||
headers: { 'Accept': 'text/html, text/ng-template' } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a feeling it would be safest to move this to the provider so that it could always be modified on an app by app basis.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. The proposal here sounds like a good default value.
BTW, this needs tests.
petebacondarwin
added a commit
to petebacondarwin/angular.js
that referenced
this pull request
Oct 28, 2015
It is now possible to configure the Accept header for template requests. If a value is configured then this will override only the Accept property of the headers that are passed. If no value is configured then the request will use the default $http Accept header. Thanks to @luckycadow for help on this feature Closes angular#11868 Closes angular#6860
We have a new PR that overrides this one, as it is configurable and has tests. |
petebacondarwin
added a commit
to petebacondarwin/angular.js
that referenced
this pull request
Oct 28, 2015
It is now possible to configure the Accept header for template requests. If a value is configured then this will override only the Accept property of the headers that are passed. If no value is configured then the request will use the default $http Accept header. Thanks to @luckycadow for help on this feature Closes angular#11868 Closes angular#6860
petebacondarwin
added a commit
to petebacondarwin/angular.js
that referenced
this pull request
Oct 28, 2015
It is now possible to configure the options sent to $http for template requests. If no value is configured then the request will use the default $http options. Thanks to @luckycadow for help on this feature Closes angular#11868 Closes angular#6860
petebacondarwin
added a commit
to petebacondarwin/angular.js
that referenced
this pull request
Oct 28, 2015
It is now possible to configure the options sent to $http for template requests. If no value is configured then the request will use the default $http options. Thanks to @luckycadow for help on this feature Closes angular#11868 Closes angular#6860
petebacondarwin
added a commit
that referenced
this pull request
Oct 28, 2015
It is now possible to configure the options sent to $http for template requests. If no value is configured then the request will use the default $http options. Thanks to @luckycadow for help on this feature Closes #13188 Closes #11868 Closes #6860
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Set the
Accept
header on HTTP requests for templates totext/html, text/ng-template
.Previously the default request headers sent by
$http
were used.Closes #6860