Skip to content

Commit

Permalink
Fix Typescript definition for StripeResource.LastResponse.headers (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
richardm-stripe authored Jul 28, 2021
1 parent 65176f1 commit 69e018c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions test/stripe.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,8 @@ describe('Stripe Module', function() {
const headers = customer.lastResponse.headers;
expect(headers).to.contain.keys('request-id');

expect(customer.headers).to.be.undefined;

resolve('Called!');
});
})
Expand Down
2 changes: 1 addition & 1 deletion types/lib.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ declare module 'stripe' {
}

export type Response<T> = T & {
headers: {[key: string]: string};
lastResponse: {
headers: {[key: string]: string};
requestId: string;
statusCode: number;
apiVersion?: string;
Expand Down
8 changes: 4 additions & 4 deletions types/test/typescriptTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ stripe.setHost('host', 'port', 'protocol');
const statusCode: number = lr.statusCode;
const apiVersion: string | undefined = lr.apiVersion;
const idempotencyKey: string | undefined = lr.idempotencyKey;
const headers = custs.headers;
const header: string | undefined = custs.headers['request-id'];
const headers = lr.headers;
const header: string | undefined = headers['request-id'];
}

{
Expand All @@ -155,8 +155,8 @@ stripe.setHost('host', 'port', 'protocol');
const statusCode: number = lr.statusCode;
const apiVersion: string | undefined = lr.apiVersion;
const idempotencyKey: string | undefined = lr.idempotencyKey;
const headers = cust.headers;
const header: string | undefined = cust.headers['request-id'];
const headers = lr.headers;
const header: string | undefined = lr.headers['request-id'];
}
{
const acct = await stripe.accounts.createExternalAccount('foo', {
Expand Down

0 comments on commit 69e018c

Please sign in to comment.