Skip to content

Commit

Permalink
Attach boolean value to the x-amzn-codewhisperer-optout header
Browse files Browse the repository at this point in the history
  • Loading branch information
imykhai committed Nov 17, 2023
1 parent 1d86abb commit 7b2cb1a
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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}`
})
},
],
Expand Down Expand Up @@ -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}`
})
},
],
Expand Down

0 comments on commit 7b2cb1a

Please sign in to comment.