refactor(cli/http): replace ky with a self-contained HTTP client (#36711)

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
L1nSn0wandClaude Opus 4.7 authored and GitHub committed 2026-06-01 09:04:42 +00:00
1 parent 055d9b9f0a
commit cfc1cf2b8c
70 files changed
+1947 -600

No files matched your search

+5 -7
View File
@@ -1,15 +1,15 @@
import type { WorkspaceDetailResponse, WorkspaceListResponse } from '@dify/contracts/api/openapi/types.gen'
import type { KyInstance } from 'ky'
import type { HttpClient } from '@/http/types'
export class WorkspacesClient {
private readonly http: KyInstance
private readonly http: HttpClient
constructor(http: KyInstance) {
constructor(http: HttpClient) {
this.http = http
}
async list(): Promise<WorkspaceListResponse> {
return this.http.get('workspaces').json<WorkspaceListResponse>()
return this.http.get<WorkspaceListResponse>('workspaces')
}
/**
@@ -22,8 +22,6 @@ export class WorkspacesClient {
* server's state.
*/
async switch(workspaceId: string): Promise<WorkspaceDetailResponse> {
return this.http
.post(`workspaces/${encodeURIComponent(workspaceId)}/switch`)
.json<WorkspaceDetailResponse>()
return this.http.post<WorkspaceDetailResponse>(`workspaces/${encodeURIComponent(workspaceId)}/switch`)
}
}