Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/restangular.js
Original file line number Diff line number Diff line change
Expand Up @@ -1148,6 +1148,7 @@
}

if (true === config.plainByDefault) {
delete data[config.restangularFields.etag];
return resolvePromise(deferred, response, data, filledArray);
}

Expand Down Expand Up @@ -1249,6 +1250,7 @@
var data;

if (true === config.plainByDefault) {
delete elem[config.restangularFields.etag];
return resolvePromise(deferred, response, elem, filledObject);
}

Expand Down
10 changes: 5 additions & 5 deletions test/restangularSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1593,25 +1593,25 @@ describe('Restangular', function () {

describe('with ETag', function () {
beforeEach(function () {
$httpBackend.whenGET('/accounts').respond(
$httpBackend.whenGET('/etagAccounts').respond(
testData.accountsModel,
{'ETag': 'c11ea3f8-3bfd-4be8-a6a6-501dd831b8a4'}
);
$httpBackend.whenGET('/accounts/1').respond(
$httpBackend.whenGET('/etagAccounts/1').respond(
testData.accountsModel[1],
{'ETag': 'bf79b780-f132-4f44-a9eb-7e6eb4f902b2'}
);
});

it('should not add restangularized ETag to response object', function () {
plainByDefaultRestangular.one('accounts', 0).get().then(function (account) {
expect(account).toEqual(testData.accountsModel[0]);
plainByDefaultRestangular.one('etagAccounts', 1).get().then(function (account) {
expect(account).toEqual(testData.accountsModel[1]);
});
$httpBackend.flush();
});

it('shoud not add restangularized ETag to response collection', function () {
plainByDefaultRestangular.all('accounts').getList().then(function (accounts) {
plainByDefaultRestangular.all('etagAccounts').getList().then(function (accounts) {
expect(accounts).toEqual(testData.accountsModel);
});
$httpBackend.flush();
Expand Down