fix(testing): parse response body to string conditionally
MODIFY
packages/testing/src/testBed/http/http.testBed.response.ts
packages/testing/src/testBed/http/http.testBed.response.ts
@@ -9,11 +9,13 @@ import { HttpTestBedRequest } from './http.testBed.request.interface';
const parseResponseBody = (props: HttpTestBedResponseProps): string | Array<any> | Record<string, any> | undefined =>
pipe(
O.fromNullable(props.body),
- O.map(body => body.toString()),
O.map(body => {
switch (getContentType(props.headers)) {
case ContentType.APPLICATION_JSON:
- return parseJson(body);
+ return pipe(body.toString(), parseJson);
+ case ContentType.TEXT_PLAIN:
+ case ContentType.TEXT_HTML:
+ return body.toString();
default:
return body;
}

fix(testing): parse response body to string conditionally