fix: normalize HTTP method to uppercase in APIRequest to comply with spec

This commit is contained in:
Elysia
2024-12-01 11:32:10 +07:00
parent d3184f24ad
commit d087fe5095

View File

@@ -144,7 +144,7 @@ class APIRequest {
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), this.client.options.restRequestTimeout).unref();
return fetch(url, {
method: this.method,
method: this.method.toUpperCase(), // Undici doesn't normalize "patch" into "PATCH" (which surprisingly follows the spec).
headers,
agent,
body,