From 67bd2fdd9529e153793770d75612cf54539c3000 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 22 May 2024 14:39:59 +0300 Subject: [PATCH] @uppy/xhr-upload: fix regression for lowercase HTTP methods (#5179) Co-authored-by: Merlijn Vos --- docs/uploader/xhr.mdx | 9 ++++++++- packages/@uppy/xhr-upload/src/index.ts | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/uploader/xhr.mdx b/docs/uploader/xhr.mdx index 1b1a429ff6..92eef37071 100644 --- a/docs/uploader/xhr.mdx +++ b/docs/uploader/xhr.mdx @@ -87,7 +87,14 @@ URL of the HTTP server (`string`, default: `null`). #### `method` Configures which HTTP method to use for the upload (`string`, default: -`'post'`). +`'POST'`). + +:::note + +Uppy is not following the standard and will uppercase the method name. This +behavior will be removed in a future version to align Uppy with the web APIs. + +::: #### `formData` diff --git a/packages/@uppy/xhr-upload/src/index.ts b/packages/@uppy/xhr-upload/src/index.ts index e0fa70c11f..cd5cafbc45 100644 --- a/packages/@uppy/xhr-upload/src/index.ts +++ b/packages/@uppy/xhr-upload/src/index.ts @@ -214,6 +214,7 @@ export default class XHRUpload< try { const res = await fetcher(url, { ...options, + method: options?.method?.toUpperCase(), onTimeout: (timeout) => { const seconds = Math.ceil(timeout / 1000) const error = new Error(this.i18n('uploadStalled', { seconds }))