it('should call clone', () => {
service.clone('foo', 'bar').subscribe();
- const req = httpTesting.expectOne('api/role/foo/clone?new_name=bar');
+ const req = httpTesting.expectOne('api/role/foo/clone');
expect(req.request.method).toBe('POST');
+ expect(req.request.body).toEqual({ new_name: 'bar' });
});
it('should check if role name exists', () => {
-import { HttpClient, HttpParams } from '@angular/common/http';
+import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable, of as observableOf } from 'rxjs';
}
clone(name: string, newName: string) {
- let params = new HttpParams();
- params = params.append('new_name', newName);
- return this.http.post(`api/role/${name}/clone`, null, { params });
+ return this.http.post(`api/role/${name}/clone`, { new_name: newName });
}
update(role: RoleFormModel) {