diff --git a/api/src/engine/connectors/exareme/main.connector.ts b/api/src/engine/connectors/exareme/main.connector.ts index 146fb4308b44b7a189b1f31cadcd37e0c35cd8c0..8619686de6a377639ea5692bec37808c75af812a 100644 --- a/api/src/engine/connectors/exareme/main.connector.ts +++ b/api/src/engine/connectors/exareme/main.connector.ts @@ -59,7 +59,9 @@ export default class ExaremeService implements IEngineService { this.options.baseurl + `experiments${isTransient ? '/transient' : ''}`; const resultAPI = await firstValueFrom( - this.httpService.post<ExperimentData>(path, form), + this.httpService.post<ExperimentData>(path, form, { + headers: this.req.headers, + }), ); return dataToExperiment(resultAPI.data); @@ -69,7 +71,10 @@ export default class ExaremeService implements IEngineService { const path = this.options.baseurl + 'experiments'; const resultAPI = await firstValueFrom( - this.httpService.get<ExperimentsData>(path, { params: { page, name } }), + this.httpService.get<ExperimentsData>(path, { + params: { page, name }, + headers: this.req.headers, + }), ); return { @@ -81,7 +86,11 @@ export default class ExaremeService implements IEngineService { async getAlgorithms(): Promise<Algorithm[]> { const path = this.options.baseurl + 'algorithms'; - const resultAPI = await firstValueFrom(this.httpService.get<string>(path)); + const resultAPI = await firstValueFrom( + this.httpService.get<string>(path, { + headers: this.req.headers, + }), + ); return dataToAlgorithms(resultAPI.data); } @@ -90,7 +99,9 @@ export default class ExaremeService implements IEngineService { const path = this.options.baseurl + `experiments/${uuid}`; const resultAPI = await firstValueFrom( - this.httpService.get<ExperimentData>(path), + this.httpService.get<ExperimentData>(path, { + headers: this.req.headers, + }), ); return dataToExperiment(resultAPI.data); @@ -103,7 +114,9 @@ export default class ExaremeService implements IEngineService { const path = this.options.baseurl + `experiments/${uuid}`; const resultAPI = await firstValueFrom( - this.httpService.patch<ExperimentData>(path, expriment), + this.httpService.patch<ExperimentData>(path, expriment, { + headers: this.req.headers, + }), ); return dataToExperiment(resultAPI.data); @@ -113,7 +126,11 @@ export default class ExaremeService implements IEngineService { const path = this.options.baseurl + `experiments/${uuid}`; try { - await firstValueFrom(this.httpService.delete(path)); + await firstValueFrom( + this.httpService.delete(path, { + headers: this.req.headers, + }), + ); return { uuid: uuid, }; @@ -127,7 +144,9 @@ export default class ExaremeService implements IEngineService { try { const data = await firstValueFrom( - this.httpService.get<Pathology[]>(path), + this.httpService.get<Pathology[]>(path, { + headers: this.req.headers, + }), ); return ( @@ -160,7 +179,9 @@ export default class ExaremeService implements IEngineService { const path = this.options.baseurl + 'activeUser'; return this.httpService - .get<string>(path) + .get<string>(path, { + headers: this.req.headers, + }) .pipe(map((response) => response.data)); } @@ -168,7 +189,9 @@ export default class ExaremeService implements IEngineService { const path = this.options.baseurl + 'activeUser/agreeNDA'; return this.httpService - .post<string>(path, this.req.body) + .post<string>(path, this.req.body, { + headers: this.req.headers, + }) .pipe(map((response) => response.data)); } @@ -176,21 +199,29 @@ export default class ExaremeService implements IEngineService { const path = this.options.baseurl + `experiments/${uuid}`; return this.httpService - .get<string>(path) + .get<string>(path, { + headers: this.req.headers, + }) .pipe(map((response) => response.data)); } deleteExperiment(uuid: string): Observable<string> { const path = this.options.baseurl + `experiments/${uuid}`; - return this.httpService.delete(path).pipe(map((response) => response.data)); + return this.httpService + .delete(path, { + headers: this.req.headers, + }) + .pipe(map((response) => response.data)); } editExperimentREST(uuid: string): Observable<string> { const path = this.options.baseurl + `experiments/${uuid}`; return this.httpService - .patch(path, this.req.body) + .patch(path, this.req.body, { + headers: this.req.headers, + }) .pipe(map((response) => response.data)); } @@ -198,7 +229,9 @@ export default class ExaremeService implements IEngineService { const path = this.options.baseurl + 'experiments/transient'; return this.httpService - .post(path, this.req.body) + .post(path, this.req.body, { + headers: this.req.headers, + }) .pipe(map((response) => response.data)); } @@ -206,7 +239,9 @@ export default class ExaremeService implements IEngineService { const path = this.options.baseurl + 'experiments'; return this.httpService - .post(path, this.req.body) + .post(path, this.req.body, { + headers: this.req.headers, + }) .pipe(map((response) => response.data)); } diff --git a/api/src/engine/engine.controller.ts b/api/src/engine/engine.controller.ts index e56fa8e7ef75d1b50b233fa28f548129126f790f..3bb5d7fd380728aea66dc54447531df64c5a3225 100644 --- a/api/src/engine/engine.controller.ts +++ b/api/src/engine/engine.controller.ts @@ -6,14 +6,11 @@ import { Param, Patch, Post, - UseInterceptors, } from '@nestjs/common'; import { Observable } from 'rxjs'; import { ENGINE_SERVICE } from './engine.constants'; import { IEngineService } from './engine.interfaces'; -import { HeadersInterceptor } from './interceptors/headers.interceptor'; -@UseInterceptors(HeadersInterceptor) @Controller() export class EngineController { constructor( diff --git a/api/src/engine/engine.resolver.ts b/api/src/engine/engine.resolver.ts index 6e23ba38ca26d1129e51abb7cbba8d311cad67b9..0cfac3a5b1fdc02c82b74cd31928a554c45bc550 100644 --- a/api/src/engine/engine.resolver.ts +++ b/api/src/engine/engine.resolver.ts @@ -1,8 +1,7 @@ -import { Inject, UseInterceptors } from '@nestjs/common'; +import { Inject } from '@nestjs/common'; import { Args, Mutation, Query, Resolver } from '@nestjs/graphql'; import { ENGINE_SERVICE } from './engine.constants'; import { IEngineService } from './engine.interfaces'; -import { HeadersInterceptor } from './interceptors/headers.interceptor'; import { Domain } from './models/domain.model'; import { Algorithm } from './models/experiment/algorithm.model'; import { @@ -13,7 +12,6 @@ import { ExperimentCreateInput } from './models/experiment/input/experiment-crea import { ExperimentEditInput } from './models/experiment/input/experiment-edit.input'; import { ListExperiments } from './models/experiment/list-experiments.model'; -@UseInterceptors(HeadersInterceptor) @Resolver() export class EngineResolver { constructor(