Renamed prepareBody to uriEncodeBody

This commit is contained in:
Giuseppe Digilio
2019-04-19 18:54:02 +02:00
parent 86324c366f
commit ea3f3cb40a
4 changed files with 7 additions and 7 deletions

View File

@@ -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&param1=value1 * returns: param=value&param1=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)

View File

@@ -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);

View File

@@ -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());
} }
/** /**

View File

@@ -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 */