Merge pull request #8287 from tchak/fix-fetchas-post

fix(fetch): always use post http method
This commit is contained in:
Paul Chavard 2022-12-15 12:13:05 +01:00 committed by GitHub
commit bcfa8ccc2f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View file

@ -134,9 +134,7 @@ export class AutosaveController extends ApplicationController {
private enqueueAutouploadRequest(target: HTMLInputElement, file: File) {
const autoupload = new AutoUpload(target, file);
try {
autoupload.start();
} catch (e) {
autoupload.start().catch((e) => {
const error = e as FileUploadError;
// Report unexpected client errors to Sentry.
// (But ignore usual client errors, or errors we can monitor better on the server side.)
@ -146,7 +144,7 @@ export class AutosaveController extends ApplicationController {
) {
throw error;
}
}
});
}
// Add a new autosave request to the queue.
@ -187,8 +185,9 @@ export class AutosaveController extends ApplicationController {
this.#pendingPromiseCount++;
return httpRequest(form.action, {
method: 'patch',
method: 'post',
body: formData,
headers: { 'x-http-method-override': 'PATCH' },
signal: this.#abortController.signal,
timeout: AUTOSAVE_TIMEOUT_DELAY
}).turbo();

View file

@ -96,8 +96,9 @@ export default class Uploader {
try {
await httpRequest(autoAttachUrl, {
method: 'put',
body: formData
method: 'post',
body: formData,
headers: { 'x-http-method-override': 'PUT' }
}).turbo();
} catch (e) {
const error = e as ResponseError;