Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/services/control-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ export class ControlApi {

// Revoke a key
async revokeKey(appId: string, keyId: string): Promise<void> {
return this.request<void>(`/apps/${appId}/keys/${keyId}`, "DELETE");
return this.request<void>(`/apps/${appId}/keys/${keyId}/revoke`, "POST");
}

// Update an app
Expand Down Expand Up @@ -588,6 +588,11 @@ export class ControlApi {
return {} as T;
}

return (await response.json()) as T;
const text = await response.text();
if (!text) {
return {} as T;
}

return JSON.parse(text) as T;
}
}
6 changes: 3 additions & 3 deletions test/unit/commands/auth/keys/revoke.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe("auth:keys:revoke command", () => {

// Mock revoke key
nockControl()
.delete(`/v1/apps/${appId}/keys/${mockKeyId}`)
.post(`/v1/apps/${appId}/keys/${mockKeyId}/revoke`)
.reply(200, {});

const { stdout } = await runCommand(
Expand All @@ -59,7 +59,7 @@ describe("auth:keys:revoke command", () => {
]);

nockControl()
.delete(`/v1/apps/${appId}/keys/${mockKeyId}`)
.post(`/v1/apps/${appId}/keys/${mockKeyId}/revoke`)
.reply(200, {});

const { stdout } = await runCommand(
Expand All @@ -76,7 +76,7 @@ describe("auth:keys:revoke command", () => {
mockKeysList(appId, [buildMockKey(appId, mockKeyId)]);

nockControl()
.delete(`/v1/apps/${appId}/keys/${mockKeyId}`)
.post(`/v1/apps/${appId}/keys/${mockKeyId}/revoke`)
.reply(200, {});

const { stdout } = await runCommand(
Expand Down
2 changes: 1 addition & 1 deletion test/unit/services/control-api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ describe("ControlApi", function () {

// Set up nock to intercept request
nock(`https://${controlHost}`)
.delete(`/v1/apps/${appId}/keys/${keyId}`)
.post(`/v1/apps/${appId}/keys/${keyId}/revoke`)
.reply(500, { message: "Failed to revoke key" });

// Intercept any calls to /me
Expand Down
Loading