Skip to content

Commit 737602e

Browse files
author
Mack
committed
fix: pass request_opts as keyword arg to _create to prevent silent idempotency header drops
The _create method signature is (data, params=None, request_opts=None). Passing request_opts positionally caused it to land in the params slot, silently dropping idempotency-key and prefer headers while appending the opts dict as URL query parameters. Fixed across all resources (pre-existing bug + new resources).
1 parent fad63fe commit 737602e

9 files changed

Lines changed: 10 additions & 10 deletions

File tree

method/resources/Accounts/Account.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def list(self, params: Optional[AccountListOpts[T]] = None) -> MethodResponse[Li
134134
return super(AccountResource, self)._list(params)
135135

136136
def create(self, opts: Union[AccountACHCreateOpts, AccountLiabilityCreateOpts], request_opts: Optional[RequestOpts] = None) -> MethodResponse[Account]:
137-
return super(AccountResource, self)._create(opts, request_opts)
137+
return super(AccountResource, self)._create(opts, request_opts=request_opts)
138138

139139
def withdraw_consent(self, acc_id: str, data: AccountWithdrawConsentOpts = { 'type': 'withdraw', 'reason': 'holder_withdrew_consent' }) -> MethodResponse[Account]: # pylint: disable=dangerous-default-value
140140
return super(AccountResource, self)._create_with_sub_path('{acc_id}/consent'.format(acc_id=acc_id), data)

method/resources/Entities/Entity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def __call__(self, _id: str) -> EntitySubResources:
143143
return EntitySubResources(_id, self.config)
144144

145145
def create(self, opts: EntityCreateOpts, request_opts: Optional[RequestOpts] = None) -> MethodResponse[Entity]:
146-
return super(EntityResource, self)._create(opts, request_opts)
146+
return super(EntityResource, self)._create(opts, request_opts=request_opts)
147147

148148
def update(self, _id: str, opts: EntityCreateOpts) -> MethodResponse[Entity]:
149149
return super(EntityResource, self)._update_with_id(_id, opts)

method/resources/Entities/ManualConnect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@ def retrieve(self, _id: str) -> MethodResponse:
5252
return super(EntityManualConnectResource, self)._get_with_id(_id)
5353

5454
def create(self, opts: ManualConnectCreateOpts, request_opts: Optional[RequestOpts] = None) -> MethodResponse:
55-
return super(EntityManualConnectResource, self)._create(opts, request_opts)
55+
return super(EntityManualConnectResource, self)._create(opts, request_opts=request_opts)

method/resources/ForwardingRequests/ForwardingRequest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,4 @@ def retrieve(self, _id: str) -> MethodResponse[ForwardingRequest]:
6565
return super(ForwardingRequestResource, self)._get_with_id(_id)
6666

6767
def create(self, opts: ForwardingRequestCreateOpts, request_opts: Optional[RequestOpts] = None) -> MethodResponse[ForwardingRequest]:
68-
return super(ForwardingRequestResource, self)._create(opts, request_opts)
68+
return super(ForwardingRequestResource, self)._create(opts, request_opts=request_opts)

method/resources/Payments/Payment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def list(self, params: Optional[PaymentListOpts] = None) -> MethodResponse[List[
130130
return super(PaymentResource, self)._list(params)
131131

132132
def create(self, opts: PaymentCreateOpts, request_opts: Optional[RequestOpts] = None) -> MethodResponse[Payment]:
133-
return super(PaymentResource, self)._create(opts, request_opts)
133+
return super(PaymentResource, self)._create(opts, request_opts=request_opts)
134134

135135
def delete(self, _id: str) -> MethodResponse[Payment]:
136136
return super(PaymentResource, self)._delete(_id)

method/resources/Report.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def retrieve(self, _id: str) -> MethodResponse[Report]:
5050
return super(ReportResource, self)._get_with_id(_id)
5151

5252
def create(self, opts: ReportCreateOpts, request_opts: Optional[RequestOpts] = None) -> MethodResponse[Report]:
53-
return super(ReportResource, self)._create(opts, request_opts)
53+
return super(ReportResource, self)._create(opts, request_opts=request_opts)
5454

5555
def download(self, _id: str) -> str:
5656
return super(ReportResource, self)._download(_id)

method/resources/Secrets/Secret.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def list(self, params: Optional[ResourceListOpts] = None) -> MethodResponse[List
3434
return super(SecretResource, self)._list(params)
3535

3636
def create(self, opts: SecretCreateOpts, request_opts: Optional[RequestOpts] = None) -> MethodResponse[Secret]:
37-
return super(SecretResource, self)._create(opts, request_opts)
37+
return super(SecretResource, self)._create(opts, request_opts=request_opts)
3838

3939
def delete(self, _id: str) -> MethodResponse[Secret]:
4040
return super(SecretResource, self)._delete(_id)

method/resources/Teams/Team.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def retrieve(self, _id: str) -> MethodResponse[MLEPublicKey]:
7070
return super(TeamPublicKeysResource, self)._get_with_id(_id)
7171

7272
def create(self, opts: MLEPublicKeyCreateOpts, request_opts: Optional[RequestOpts] = None) -> MethodResponse[MLEPublicKey]:
73-
return super(TeamPublicKeysResource, self)._create(opts, request_opts)
73+
return super(TeamPublicKeysResource, self)._create(opts, request_opts=request_opts)
7474

7575
def delete(self, _id: str) -> MethodResponse[MLEPublicKey]:
7676
return super(TeamPublicKeysResource, self)._delete(_id)
@@ -88,7 +88,7 @@ def retrieve(self) -> MethodResponse[Team]:
8888
return super(TeamResource, self)._get()
8989

9090
def create(self, opts: TeamCreateOpts, request_opts: Optional[RequestOpts] = None) -> MethodResponse[Team]:
91-
return super(TeamResource, self)._create(opts, request_opts)
91+
return super(TeamResource, self)._create(opts, request_opts=request_opts)
9292

9393
def update_encryption_key(self, opts: TeamEncryptionKeyOpts) -> MethodResponse[Team]:
9494
return super(TeamResource, self)._create_with_sub_path('default_encryption_key', opts)

method/resources/Webhook.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def list(self) -> MethodResponse[List[Webhook]]:
112112
return super(WebhookResource, self)._list(None)
113113

114114
def create(self, opts: WebhookCreateOpts, request_opts: Optional[RequestOpts] = None) -> MethodResponse[Webhook]:
115-
return super(WebhookResource, self)._create(opts, request_opts)
115+
return super(WebhookResource, self)._create(opts, request_opts=request_opts)
116116

117117
def update(self, _id: str, opts: WebhookUpdateOpts) -> MethodResponse[Webhook]:
118118
return super(WebhookResource, self)._patch_with_id(_id, opts)

0 commit comments

Comments
 (0)