Skip to content

Commit adbefc8

Browse files
removed incompatible implementation for single resource POST
1 parent 99c2bd5 commit adbefc8

2 files changed

Lines changed: 1 addition & 22 deletions

File tree

src/restangular.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,11 +1119,7 @@ module.provider('Restangular', function() {
11191119
var elem = parseResponse(resData, operation, route, fetchUrl, response, deferred);
11201120
if (elem) {
11211121

1122-
if (
1123-
operation === "post" &&
1124-
!__this[config.restangularFields.restangularCollection] &&
1125-
!__this[config.restangularFields.singleOne]
1126-
) {
1122+
if (operation === "post" && !__this[config.restangularFields.restangularCollection]) {
11271123
resolvePromise(deferred, response, restangularizeElem(__this, elem, what, true, null, fullParams), filledObject);
11281124
} else {
11291125
data = restangularizeElem(__this[config.restangularFields.parentResource], elem, __this[config.restangularFields.route], true, null, fullParams)

test/restangularSpec.js

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,6 @@ describe("Restangular", function() {
6363
return [200, data, ""];
6464
});
6565

66-
$httpBackend.whenPOST("/info").respond(function(method, url, data) {
67-
var newData = angular.fromJson(data);
68-
newData.fromServer = true;
69-
newData.id = 666;
70-
return [200, JSON.stringify(newData), ""];
71-
});
72-
7366
$httpBackend.whenGET("/accountsHAL").respond(accountsHalModel);
7467
$httpBackend.whenPUT("/accountsHAL/martin").respond(function(method, url, data) {
7568
accountsHalModel[0] = angular.fromJson(data);
@@ -736,16 +729,6 @@ describe("Restangular", function() {
736729
$httpBackend.flush();
737730
});
738731

739-
it('getRestangularUrl() returns still the url without id after POST', function() {
740-
record = Restangular.one('info', 0, true);
741-
record.post().then(function(data){
742-
expect(data.id).toEqual(666);
743-
expect(data.getRestangularUrl()).toEqual("/info");
744-
});
745-
$httpBackend.expectPOST('/info');
746-
$httpBackend.flush();
747-
});
748-
749732
it('does not use the id for single nested resource GET', function() {
750733
Restangular.one('accounts', 1).one('info', 0, true).get()
751734
$httpBackend.expectGET('/accounts/1/info');

0 commit comments

Comments
 (0)