From 0d2718d1b02ca279848311548b643160e38feafe Mon Sep 17 00:00:00 2001 From: agnisa-cap Date: Fri, 3 Nov 2023 14:35:38 +0100 Subject: [PATCH] N21-1329 adds gzip as encoding for provisioning data request (#4513) --- .../strategy/sanis/sanis.strategy.spec.ts | 16 +++++++++++++++- .../strategy/sanis/sanis.strategy.ts | 5 ++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/apps/server/src/modules/provisioning/strategy/sanis/sanis.strategy.spec.ts b/apps/server/src/modules/provisioning/strategy/sanis/sanis.strategy.spec.ts index f0ea97f89fd..0ef8173c2d2 100644 --- a/apps/server/src/modules/provisioning/strategy/sanis/sanis.strategy.spec.ts +++ b/apps/server/src/modules/provisioning/strategy/sanis/sanis.strategy.spec.ts @@ -188,7 +188,21 @@ describe('SanisStrategy', () => { provisioningUrl, expect.objectContaining({ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - headers: expect.objectContaining({ Authorization: 'Bearer sanisAccessToken' }), + headers: expect.objectContaining({ Authorization: 'Bearer sanisAccessToken', 'Accept-Encoding': 'gzip' }), + }) + ); + }); + + it('should accept gzip compressed data', async () => { + const { input, provisioningUrl } = setup(); + + await strategy.getData(input); + + expect(httpService.get).toHaveBeenCalledWith( + provisioningUrl, + expect.objectContaining({ + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment + headers: expect.objectContaining({ 'Accept-Encoding': 'gzip' }), }) ); }); diff --git a/apps/server/src/modules/provisioning/strategy/sanis/sanis.strategy.ts b/apps/server/src/modules/provisioning/strategy/sanis/sanis.strategy.ts index a09ae204c69..ad48ae06d93 100644 --- a/apps/server/src/modules/provisioning/strategy/sanis/sanis.strategy.ts +++ b/apps/server/src/modules/provisioning/strategy/sanis/sanis.strategy.ts @@ -39,7 +39,10 @@ export class SanisProvisioningStrategy extends OidcProvisioningStrategy { } const axiosConfig: AxiosRequestConfig = { - headers: { Authorization: `Bearer ${input.accessToken}` }, + headers: { + Authorization: `Bearer ${input.accessToken}`, + 'Accept-Encoding': 'gzip', + }, }; const axiosResponse: AxiosResponse = await firstValueFrom(