Skip to content

Commit 08a8a73

Browse files
claude[bot]claude
andauthored
fix: delete requests drop query params passed via {query: ...} (#1668)
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 53a506b commit 08a8a73

5 files changed

Lines changed: 18 additions & 11 deletions

File tree

src/pipes/pipes.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,10 @@ describe('Pipes', () => {
308308
expect(new URL(String(fetchURL())).pathname).toBe(
309309
'/user_management/users/test_userId/connected_accounts/test_slug',
310310
);
311+
expect(fetchSearchParams()).toEqual({
312+
organization_id: 'org_01EHZNVPK3SFK441A1RGBFSHRT',
313+
});
314+
expect(fetchSearchParams()).not.toHaveProperty('query');
311315
});
312316
});
313317

src/pipes/pipes.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -477,11 +477,9 @@ export class Pipes {
477477
await this.workos.delete(
478478
`/user_management/users/${encodeURIComponent(userId)}/connected_accounts/${encodeURIComponent(slug)}`,
479479
{
480-
query: {
481-
...(options.organizationId !== undefined && {
482-
organization_id: options.organizationId,
483-
}),
484-
},
480+
...(options.organizationId !== undefined && {
481+
organization_id: options.organizationId,
482+
}),
485483
},
486484
);
487485
}

src/vault/vault.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,10 @@ describe('Vault', () => {
201201

202202
expect(fetchMethod()).toBe('DELETE');
203203
expect(new URL(String(fetchURL())).pathname).toBe('/vault/v1/kv/test_id');
204+
expect(fetchSearchParams()).toEqual({
205+
version_check: 'test_version_check',
206+
});
207+
expect(fetchSearchParams()).not.toHaveProperty('query');
204208
});
205209
});
206210

src/vault/vault.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -305,11 +305,9 @@ export class Vault {
305305
async deleteObject(options: DeleteVaultObjectOptions): Promise<void> {
306306
const { id } = options;
307307
await this.workos.delete(`/vault/v1/kv/${encodeURIComponent(id)}`, {
308-
query: {
309-
...(options.versionCheck !== undefined && {
310-
version_check: options.versionCheck,
311-
}),
312-
},
308+
...(options.versionCheck !== undefined && {
309+
version_check: options.versionCheck,
310+
}),
313311
});
314312
}
315313

src/workos.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,10 @@ export class WorkOS {
358358
return { data: await res.toJSON() };
359359
}
360360

361-
async delete(path: string, query?: any): Promise<void> {
361+
async delete(
362+
path: string,
363+
query?: Record<string, string | number | boolean | undefined>,
364+
): Promise<void> {
362365
this.requireApiKey(path);
363366

364367
try {

0 commit comments

Comments
 (0)