Skip to content

Commit

Permalink
fix: removes includeResponseHeaders from proxy service (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
brigonzalez authored Jul 27, 2023
1 parent a5c1731 commit f43fdcc
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/BasisTheoryElements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ export class BasisTheoryElements {
apiKey: BasisTheoryElements.getApiKey(apiKey),
});

const result = BasisTheoryElements.replaceTokenData({ data: token.data });
const result = BasisTheoryElements.replaceSensitiveData({
data: token.data,
});

token.data = result.data as TokenData;

Expand All @@ -47,21 +49,23 @@ export class BasisTheoryElements {
{
method,
...proxyRequest
}: ProxyRequestOptions & { method: keyof BasisTheory['proxy'] },
}: Omit<ProxyRequestOptions, 'includeResponseHeaders'> & {
method: keyof BasisTheory['proxy'];
},
apiKey?: string
): Promise<unknown> {
const btInstance = await BasisTheoryElements.getBtInstance(apiKey);

proxyRequest.apiKey = apiKey;
const proxyResponse = await btInstance.proxy[method](proxyRequest);
const result = BasisTheoryElements.replaceTokenData({
const result = BasisTheoryElements.replaceSensitiveData({
data: proxyResponse,
});

return result.data;
}

private static replaceTokenData(
private static replaceSensitiveData(
token: Record<string, unknown>,
result: Record<string, unknown> = {},
parentObject: unknown = undefined
Expand Down Expand Up @@ -95,7 +99,7 @@ export class BasisTheoryElements {
[]
);
} else {
BasisTheoryElements.replaceTokenData(
BasisTheoryElements.replaceSensitiveData(
value as Record<string, unknown>,
result,
tokenDataPath
Expand Down

0 comments on commit f43fdcc

Please sign in to comment.