diff --git a/src/client.ts b/src/client.ts index 70900ed..1d1e535 100644 --- a/src/client.ts +++ b/src/client.ts @@ -52,7 +52,21 @@ export class GiteaClient { } async delete(endpoint: string, body?: unknown): Promise { - return this.request(this.buildUrl(endpoint), 'DELETE', body); + if (body === undefined) { + return this.request(this.buildUrl(endpoint), 'DELETE'); + } + // Use fetch for DELETE+body — node:https drops the body on some + // proxy/TLS configurations, causing the server to see an empty request. + const url = this.buildUrl(endpoint); + const resp = await fetch(url, { + method: 'DELETE', + headers: { ...this.headers }, + body: JSON.stringify(body), + }); + const raw = await resp.text(); + let data: unknown; + try { data = JSON.parse(raw); } catch { data = raw; } + return { status: resp.status, data }; } private buildUrl(endpoint: string, params?: Record): string {