Skip to content

Commit f2bca15

Browse files
committed
Only restangularized object get stripped
Fixes #420
1 parent 6870978 commit f2bca15

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,7 @@ These are the methods that can be called on the Restangular object.
577577
* **trace: ([queryParams, headers])**: Does a TRACE
578578
* **options: ([queryParams, headers])**: Does a OPTIONS
579579
* **patch(object, [queryParams, headers])**: Does a PATCH
580+
* **remove([queryParams, headers])**: Does a DELETE
580581
* **putElement(idx, params, headers)**: Puts the element on the required index and returns a promise of the updated new array
581582
* **getRestangularUrl()**: Gets the URL of the current object.
582583
* **getRequestedUrl()**: Gets the real URL the current object was requested with (incl. GET parameters). Will equal getRestangularUrl() when no parameters were used, before calling `getList()`, or when using on a nested child.

src/restangular.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,10 @@ module.provider('Restangular', function() {
181181
return this;
182182
};
183183

184+
config.isRestangularized = function(obj) {
185+
return !!obj.one || !!obj.all;
186+
}
187+
184188
config.setFieldToElem = function(field, elem, value) {
185189
var properties = field.split('.');
186190
var idValue = elem;
@@ -982,7 +986,8 @@ module.provider('Restangular', function() {
982986

983987
var callObj = obj || this;
984988
var etag = callObj[config.restangularFields.etag];
985-
if (_.isObject(callObj)) {
989+
990+
if (_.isObject(callObj) && config.isRestangularized(callObj)) {
986991
callObj = stripRestangular(callObj);
987992
}
988993
var request = config.fullRequestInterceptor(callObj, operation, route, fetchUrl,

0 commit comments

Comments
 (0)