Skip to content

Commit

Permalink
Merge pull request #26 from lemoncloud-io/feature/louis-fix-add-header
Browse files Browse the repository at this point in the history
fix(minor): fix custom headers in AWS http request
  • Loading branch information
louis-lemon authored Jun 11, 2024
2 parents ac74cc1 + 2190412 commit d2e736d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/http/aws-http-request.builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export class AWSHttpRequestBuilder {
const hasNoHeader = isEmptyObject(header);
if (hasNoHeader) {
this.logger.warn('signedClient is missing => Request without signing');
return null;
return this.config.headers;
}
return this.addXLemonIdentityToHeader(header);
}
Expand All @@ -204,11 +204,12 @@ export class AWSHttpRequestBuilder {
private async addXLemonIdentityToHeader(header: any): Promise<AxiosHeaders> {
const useXLemonIdentity = await this.tokenStorage.getItem(USE_X_LEMON_IDENTITY_KEY);
if (!useXLemonIdentity || useXLemonIdentity === 'false') {
return header;
return { ...header, ...this.config.headers };
}
const identityToken = await this.tokenStorage.getItem('identityToken');
return {
...header,
...this.config.headers,
'x-lemon-identity': identityToken,
};
}
Expand Down

0 comments on commit d2e736d

Please sign in to comment.