]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Fix for broken User management role cloning 40216/head
authorNizamudeen A <nia@redhat.com>
Thu, 18 Mar 2021 12:58:33 +0000 (18:28 +0530)
committerNizamudeen A <nia@redhat.com>
Mon, 22 Mar 2021 05:09:19 +0000 (10:39 +0530)
Cloning a role in user management gets hit with a 415 error.

Fixes: https://tracker.ceph.com/issues/49880
Signed-off-by: Nizamudeen A <nia@redhat.com>
src/pybind/mgr/dashboard/frontend/src/app/shared/api/role.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/role.service.ts

index 8505461ff9596ba7ce9a1bfb974b6ed659063ec7..c5af5877c84b3fae2bd0b32245c376a2eada5a41 100644 (file)
@@ -46,8 +46,9 @@ describe('RoleService', () => {
 
   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', () => {
index 7dc906da18bb746fa40263ae5b020c93818ddafd..e76846b418f06df24e8d42c2e63a483de9d2cea9 100644 (file)
@@ -1,4 +1,4 @@
-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';
@@ -29,9 +29,7 @@ export class RoleService {
   }
 
   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) {