feat: remove api metadata decorating html responses
This commit is contained in:
parent
7c271be310
commit
3035cbc5de
1 changed files with 10 additions and 0 deletions
|
@ -162,6 +162,12 @@ export class HttpService implements HttpServiceInterface {
|
|||
|
||||
this.applyResponseHeaders(serviceResponse, response)
|
||||
|
||||
if (this.responseShouldNotBeDecorated(serviceResponse)) {
|
||||
response.status(serviceResponse.status).send(serviceResponse.data)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
response.status(serviceResponse.status).send({
|
||||
meta: {
|
||||
auth: {
|
||||
|
@ -213,6 +219,10 @@ export class HttpService implements HttpServiceInterface {
|
|||
return payload
|
||||
}
|
||||
|
||||
private responseShouldNotBeDecorated(serviceResponse: AxiosResponse): boolean {
|
||||
return serviceResponse.headers['content-type'].toLowerCase().includes('text/html')
|
||||
}
|
||||
|
||||
private applyResponseHeaders(serviceResponse: AxiosResponse, response: Response): void {
|
||||
const returnedHeadersFromUnderlyingService = [
|
||||
'access-control-allow-methods',
|
||||
|
|
Loading…
Reference in a new issue