diff --git a/src.ts/utils/fetch.ts b/src.ts/utils/fetch.ts index f540c4f69..1462580f9 100644 --- a/src.ts/utils/fetch.ts +++ b/src.ts/utils/fetch.ts @@ -1,6 +1,6 @@ /** * Fetching content from the web is environment-specific, so Ethers - * provides an abstraction the each environment can implement to provide + * provides an abstraction that each environment can implement to provide * this service. * * On [Node.js](link-node), the ``http`` and ``https`` libs are used to @@ -8,10 +8,10 @@ * and populate the [[FetchResponse]]. * * In a browser, the [DOM fetch](link-js-fetch) is used, and the resulting - * ``Promise`` is waited on to retreive the payload. + * ``Promise`` is waited on to retrieve the payload. * * The [[FetchRequest]] is responsible for handling many common situations, - * such as redirects, server throttling, authentcation, etc. + * such as redirects, server throttling, authentication, etc. * * It also handles common gateways, such as IPFS and data URIs. * @@ -26,7 +26,7 @@ import { toUtf8Bytes, toUtf8String } from "./utf8.js" import { createGetUrl } from "./geturl.js"; /** - * An environments implementation of ``getUrl`` must return this type. + * An environment's implementation of ``getUrl`` must return this type. */ export type GetUrlResponse = { statusCode: number, @@ -204,7 +204,7 @@ export class FetchRequest implements Iterable<[ key: string, value: string ]> { #getUrlFunc: null | FetchGetUrlFunc; /** - * The fetch URI to requrest. + * The fetch URL to request. */ get url(): string { return this.#url; } set url(url: string) { @@ -219,15 +219,15 @@ export class FetchRequest implements Iterable<[ key: string, value: string ]> { * header. * * If %%body%% is null, the body is cleared (along with the - * intrinsic ``Content-Type``) and the . + * intrinsic ``Content-Type``). * - * If %%body%% is a string, the intrincis ``Content-Type`` is set to + * If %%body%% is a string, the intrinsic ``Content-Type`` is set to * ``text/plain``. * - * If %%body%% is a Uint8Array, the intrincis ``Content-Type`` is set to + * If %%body%% is a Uint8Array, the intrinsic ``Content-Type`` is set to * ``application/octet-stream``. * - * If %%body%% is any other object, the intrincis ``Content-Type`` is + * If %%body%% is any other object, the intrinsic ``Content-Type`` is * set to ``application/json``. */ get body(): null | Uint8Array { @@ -278,7 +278,7 @@ export class FetchRequest implements Iterable<[ key: string, value: string ]> { * The headers that will be used when requesting the URI. All * keys are lower-case. * - * This object is a copy, so any chnages will **NOT** be reflected + * This object is a copy, so any changes will **NOT** be reflected * in the ``FetchRequest``. * * To set a header entry, use the ``setHeader`` method. @@ -381,7 +381,7 @@ export class FetchRequest implements Iterable<[ key: string, value: string ]> { } /** - * The timeout (in milliseconds) to wait for a complere response. + * The timeout (in milliseconds) to wait for a complete response. * //(default: 5 minutes)// */ get timeout(): number { return this.#timeout; } @@ -610,7 +610,7 @@ export class FetchRequest implements Iterable<[ key: string, value: string ]> { * to %%location%%. */ redirect(location: string): FetchRequest { - // Redirection; for now we only support absolute locataions + // Redirection; for now we only support absolute locations const current = this.url.split(":")[0].toLowerCase(); const target = location.split(":")[0].toLowerCase(); @@ -764,7 +764,7 @@ interface ThrottleError extends Error { }; /** - * The response for a FetchREquest. + * The response for a FetchRequest. */ export class FetchResponse implements Iterable<[ key: string, value: string ]> { #statusCode: number; @@ -909,7 +909,7 @@ export class FetchResponse implements Iterable<[ key: string, value: string ]> { } /** - * Returns true of the response has a body. + * Returns true if the response has a body. */ hasBody(): this is (FetchResponse & { body: Uint8Array }) { return (this.#body != null);