-
Notifications
You must be signed in to change notification settings - Fork 835
Open
Labels
Description
Restangular is configured with setPlainByDefault(true)
. When running a query such as get()
or getList()
that retrieves a response with an ETag exposed, the result contains restangularEtag.
angular.module('app', ['restangular'])
.config(function(RestangularProvider) {
RestangularProvider.setBaseUrl('https://exposedetagresponder.org/');
RestangularProvider.setPlainByDefault(true);
})
.controller('main', function($scope, Restangular) {
Restangular.one('resource').get().then(elem => {
console.log(elem.restangularEtag); // Outputs the response's etag
});
Restangular.all('resources').getList().then(list => {
console.log(list.restangularEtag); // Outputs the response's etag
});
});
This is inconsistent with the behavior when calling plain()
on the result directly, even though these are apparently intended to have the same outcome. (94ffaf0)
angular.module('app', ['restangular'])
.config(function(RestangularProvider) {
RestangularProvider.setBaseUrl('https://exposedetagresponder.org/');
})
.controller('main', function($scope, Restangular) {
Restangular.one('resource').get().then(elem => {
console.log(elem.plain().restangularEtag); // Outputs undefined
});
Restangular.all('resources').getList().then(list => {
console.log(list.plain().restangularEtag); // Outputs undefined
});
});