Procházet zdrojové kódy

@uppy/xhr-upload: fix regression for lowercase HTTP methods (#5179)

Co-authored-by: Merlijn Vos <merlijn@soverin.net>
Antoine du Hamel před 11 měsíci
rodič
revize
67bd2fdd95
2 změnil soubory, kde provedl 9 přidání a 1 odebrání
  1. 8 1
      docs/uploader/xhr.mdx
  2. 1 0
      packages/@uppy/xhr-upload/src/index.ts

+ 8 - 1
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`
 

+ 1 - 0
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 }))