From 7b2cb1a0d9c516406af545fe160f431822035b6c Mon Sep 17 00:00:00 2001 From: Ivan Mykhailovskyi Date: Fri, 17 Nov 2023 11:02:58 +0000 Subject: [PATCH] Attach boolean value to the x-amzn-codewhisperer-optout header --- .../src/language-server/codeWhispererService.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/server/aws-lsp-codewhisperer/src/language-server/codeWhispererService.ts b/server/aws-lsp-codewhisperer/src/language-server/codeWhispererService.ts index 971982a0..bafe52b8 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/codeWhispererService.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/codeWhispererService.ts @@ -60,9 +60,7 @@ export class CodeWhispererServiceIAM extends CodeWhispererServiceBase { onRequestSetup: [ req => { req.on('build', ({ httpRequest }) => { - if (!this.shareCodeWhispererContentWithAWS) { - httpRequest.headers['x-amzn-codewhisperer-optout'] = '' - } + httpRequest.headers['x-amzn-codewhisperer-optout'] = `${!this.shareCodeWhispererContentWithAWS}` }) }, ], @@ -113,9 +111,7 @@ export class CodeWhispererServiceToken extends CodeWhispererServiceBase { throw new Error('Authorization failed, bearer token is not set') } httpRequest.headers['Authorization'] = `Bearer ${creds.token}` - if (!this.shareCodeWhispererContentWithAWS) { - httpRequest.headers['x-amzn-codewhisperer-optout'] = '' - } + httpRequest.headers['x-amzn-codewhisperer-optout'] = `${!this.shareCodeWhispererContentWithAWS}` }) }, ],