chore: add timeout mechanism for fetch calls (#3649)

This commit is contained in:
Kunal Kundu
2020-05-12 19:21:13 +05:30
committed by GitHub
parent 334304ed52
commit 3e34e52440
11 changed files with 66 additions and 28 deletions

View File

@ -1,5 +1,5 @@
import minimatch from 'minimatch';
import { ApiRequest, PointerFile } from 'netlify-cms-lib-util';
import { ApiRequest, PointerFile, unsentRequest } from 'netlify-cms-lib-util';
type MakeAuthorizedRequest = (req: ApiRequest) => Promise<Response>;
@ -63,7 +63,7 @@ export class GitLfsClient {
}
private async doUpload(upload: LfsBatchAction, resource: Blob) {
await fetch(decodeURI(upload.href), {
await unsentRequest.fetchWithTimeout(decodeURI(upload.href), {
method: 'PUT',
body: resource,
headers: upload.header,