mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-08 10:34:15 +00:00
Renamed prepareBody to uriEncodeBody
This commit is contained in:
@@ -161,7 +161,7 @@ export class RequestService {
|
|||||||
/**
|
/**
|
||||||
* Convert request Payload to a URL-encoded string
|
* Convert request Payload to a URL-encoded string
|
||||||
*
|
*
|
||||||
* e.g. prepareBody({param: value, param1: value1})
|
* e.g. uriEncodeBody({param: value, param1: value1})
|
||||||
* returns: param=value¶m1=value1
|
* returns: param=value¶m1=value1
|
||||||
*
|
*
|
||||||
* @param body
|
* @param body
|
||||||
@@ -169,7 +169,7 @@ export class RequestService {
|
|||||||
* @return string
|
* @return string
|
||||||
* URL-encoded string
|
* URL-encoded string
|
||||||
*/
|
*/
|
||||||
public prepareBody(body: any) {
|
public uriEncodeBody(body: any) {
|
||||||
let queryParams = '';
|
let queryParams = '';
|
||||||
if (isNotEmpty(body) && typeof body === 'object') {
|
if (isNotEmpty(body) && typeof body === 'object') {
|
||||||
Object.keys(body)
|
Object.keys(body)
|
||||||
|
@@ -66,7 +66,7 @@ describe('ClaimedTaskDataService', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
spyOn(service, 'postToEndpoint');
|
spyOn(service, 'postToEndpoint');
|
||||||
requestService.prepareBody.and.returnValue(body);
|
requestService.uriEncodeBody.and.returnValue(body);
|
||||||
|
|
||||||
service.approveTask(scopeId);
|
service.approveTask(scopeId);
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ describe('ClaimedTaskDataService', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
spyOn(service, 'postToEndpoint');
|
spyOn(service, 'postToEndpoint');
|
||||||
requestService.prepareBody.and.returnValue(body);
|
requestService.uriEncodeBody.and.returnValue(body);
|
||||||
|
|
||||||
service.rejectTask(reason, scopeId);
|
service.rejectTask(reason, scopeId);
|
||||||
|
|
||||||
|
@@ -70,7 +70,7 @@ export class ClaimedTaskDataService extends TasksService<ClaimedTask> {
|
|||||||
const body = {
|
const body = {
|
||||||
submit_approve: 'true'
|
submit_approve: 'true'
|
||||||
};
|
};
|
||||||
return this.postToEndpoint(this.linkPath, this.requestService.prepareBody(body), scopeId, this.makeHttpOptions());
|
return this.postToEndpoint(this.linkPath, this.requestService.uriEncodeBody(body), scopeId, this.makeHttpOptions());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -88,7 +88,7 @@ export class ClaimedTaskDataService extends TasksService<ClaimedTask> {
|
|||||||
submit_reject: 'true',
|
submit_reject: 'true',
|
||||||
reason
|
reason
|
||||||
};
|
};
|
||||||
return this.postToEndpoint(this.linkPath, this.requestService.prepareBody(body), scopeId, this.makeHttpOptions());
|
return this.postToEndpoint(this.linkPath, this.requestService.uriEncodeBody(body), scopeId, this.makeHttpOptions());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -8,7 +8,7 @@ export function getMockRequestService(requestEntry$: Observable<RequestEntry> =
|
|||||||
generateRequestId: 'clients/b186e8ce-e99c-4183-bc9a-42b4821bdb78',
|
generateRequestId: 'clients/b186e8ce-e99c-4183-bc9a-42b4821bdb78',
|
||||||
getByHref: requestEntry$,
|
getByHref: requestEntry$,
|
||||||
getByUUID: requestEntry$,
|
getByUUID: requestEntry$,
|
||||||
prepareBody: jasmine.createSpy('prepareBody'),
|
uriEncodeBody: jasmine.createSpy('uriEncodeBody'),
|
||||||
/* tslint:disable:no-empty */
|
/* tslint:disable:no-empty */
|
||||||
removeByHrefSubstring: () => {}
|
removeByHrefSubstring: () => {}
|
||||||
/* tslint:enable:no-empty */
|
/* tslint:enable:no-empty */
|
||||||
|
Reference in New Issue
Block a user