- 
                Notifications
    
You must be signed in to change notification settings  - Fork 27.3k
 
feat($templateRequest): support configuration of accept headers #13188
Conversation
| 
           @petebacondarwin the code looks good to me, but I wonder if the current design is not too restrictive. Maybe we should allow people to set any headers and not limit ourselves to  If all the use-cases we know of are boiling down to setting   | 
    
| 
           @pkozlowski-opensource thanks for the review. I think that you are right. It might even bring the code size down a touch! I will update.  | 
    
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
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
ea0cb90    to
    cb43c23      
    Compare
  
    | 
           @pkozlowski-opensource - any chance you can take another look?  | 
    
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.
Shouldn't it be other way around? I mean, we should always enforce cache: $templateCache and certain transform, no?
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.
Could you add a test for a case where someone tries to specify cache?
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.
The point of modifying the transformResponse is that the default $http service adds in a JSON transformation, which we don't want in $templateRequest.
If we are going to allow people to configure the options then we should allow them to override everything, including this transformResponse and also to provide their own cache if we really wanted them to; although the same could be achieved by overriding the $templateCache service itself.
I can add a test for overriding the cache but it is really just the same code path as overriding the transformResponse.
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.
Doh! I see what you mean. You cannot create a cache object in the provider...
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
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 #11868
Closes #6860