mgonto/restangular

$remove() id as query parameter

k1ng440 opened this issue · 1 comments

Hello,
$remove() is sending the id as query (http://domain/path?id=abc instead of path (http://domain/path/abc)

my id is not numeric.

how do i fix it?

@k1ng440 I wrote a test like this

    it('Should remove correctly with an alphanumeric id', function () {
      var account = Restangular.one('accounts', 'abc');
      $httpBackend.expectDELETE('/accounts/abc').respond(200);
      account.remove();

      $httpBackend.flush();
    });

Which shows that when you create a Restangular object using for example Restangular.one('accounts', 'abc'); then the .remove() method will delete the item properly.

However, if you call the method with parameters, i.e. .remove('abc') then the first parameter will become a query parameter on the URL as per the docs. This is probably what you are experiencing?