diff --git a/package.json b/package.json index 74c26efb..d5e3b72f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fauna", - "version": "1.0.0", + "version": "1.0.1", "description": "A driver to query Fauna databases in browsers, Node.js, and other Javascript runtimes", "homepage": "https://fauna.com", "bugs": { diff --git a/src/http-client/fetch-client.ts b/src/http-client/fetch-client.ts index 24a06a09..b4c1b721 100644 --- a/src/http-client/fetch-client.ts +++ b/src/http-client/fetch-client.ts @@ -28,11 +28,21 @@ export class FetchClient implements HTTPClient { method, client_timeout_ms, }: HTTPRequest): Promise { + const signal = + AbortSignal.timeout === undefined + ? (() => { + const controller = new AbortController(); + const signal = controller.signal; + setTimeout(() => controller.abort(), client_timeout_ms); + return signal; + })() + : AbortSignal.timeout(client_timeout_ms); + const response = await fetch(this.#url, { method, headers: { ...requestHeaders, "Content-Type": "application/json" }, body: JSON.stringify(data), - signal: AbortSignal.timeout(client_timeout_ms), + signal, keepalive: this.#keepalive, }).catch((error) => { throw new NetworkError("The network connection encountered a problem.", { diff --git a/src/util/package-version.ts b/src/util/package-version.ts index c16893cf..b3bd471e 100644 --- a/src/util/package-version.ts +++ b/src/util/package-version.ts @@ -1,4 +1,4 @@ //THIS FILE IS AUTOGENERATED. DO NOT EDIT. SEE .husky/pre-commit /** The current package version. */ -export const packageVersion = "1.0.0"; +export const packageVersion = "1.0.1";