Function: fetch()
Performs an HTTP(S) fetch
Param
The URL to send the request to. Can be either a string
or an URL
object.
url
should be an absolute url, such as https://example.com/
. A path-relative URL (/file/under/root
) or protocol-relative URL (//can-be-http-or-https.com/
) will result in a rejected Promise
.
Param
The `Request` (RequestInit for TypeScript)
Param
The FetchResultTypes
Call Signature
Defined in: projects/utilities/packages/fetch/src/lib/fetch.ts:16
Performs an HTTP(S) fetch
Type Parameters
Type Parameter |
---|
R |
Parameters
Parameter | Type | Description |
---|---|---|
url | string | URL | The URL to send the request to. Can be either a string or an URL object. url should be an absolute url, such as https://example.com/ . A path-relative URL (/file/under/root ) or protocol-relative URL (//can-be-http-or-https.com/ ) will result in a rejected Promise . |
type ? | JSON | The FetchResultTypes |
Returns
Promise
<R
>
The return type is determined by the provided type
.
- When using
FetchResultTypes.JSON
then the return type isunknown
by default. The type should be specified by filling in the generic type of the function, or casting the result. - When using
FetchResultTypes.Buffer
the return type will be `Buffer`. - When using
FetchResultTypes.Blob
the return type will be a `Blob`. - When using
FetchResultTypes.Text
the return type will be astring
- When using
FetchResultTypes.Result
the return type will be a `Response` (Response in typescript)
A JSON of the response body. Defaults to unknown
, with the type set by passing the generic type of this function, or casting the result.
Param
The URL to send the request to. Can be either a string
or an URL
object.
url
should be an absolute url, such as https://example.com/
. A path-relative URL (/file/under/root
) or protocol-relative URL (//can-be-http-or-https.com/
) will result in a rejected Promise
.
Param
The `Request` (RequestInit for TypeScript)
Param
The FetchResultTypes
Call Signature
fetch<
R
>(url
:string
|URL
,options
:RequestOptions
,type
?:JSON
):Promise
<R
>
Defined in: projects/utilities/packages/fetch/src/lib/fetch.ts:27
Performs an HTTP(S) fetch
Type Parameters
Type Parameter |
---|
R |
Parameters
Parameter | Type | Description |
---|---|---|
url | string | URL | The URL to send the request to. Can be either a string or an URL object. url should be an absolute url, such as https://example.com/ . A path-relative URL (/file/under/root ) or protocol-relative URL (//can-be-http-or-https.com/ ) will result in a rejected Promise . |
options | RequestOptions | The `Request` (RequestInit for TypeScript) |
type ? | JSON | The FetchResultTypes |
Returns
Promise
<R
>
The return type is determined by the provided type
.
- When using
FetchResultTypes.JSON
then the return type isunknown
by default. The type should be specified by filling in the generic type of the function, or casting the result. - When using
FetchResultTypes.Buffer
the return type will be `Buffer`. - When using
FetchResultTypes.Blob
the return type will be a `Blob`. - When using
FetchResultTypes.Text
the return type will be astring
- When using
FetchResultTypes.Result
the return type will be a `Response` (Response in typescript)
A JSON of the response body. Defaults to unknown
, with the type set by passing the generic type of this function, or casting the result.
Param
The URL to send the request to. Can be either a string
or an URL
object.
url
should be an absolute url, such as https://example.com/
. A path-relative URL (/file/under/root
) or protocol-relative URL (//can-be-http-or-https.com/
) will result in a rejected Promise
.
Param
The `Request` (RequestInit for TypeScript)
Param
The FetchResultTypes
Call Signature
Defined in: projects/utilities/packages/fetch/src/lib/fetch.ts:37
Performs an HTTP(S) fetch
Parameters
Parameter | Type | Description |
---|---|---|
url | string | URL | The URL to send the request to. Can be either a string or an URL object. url should be an absolute url, such as https://example.com/ . A path-relative URL (/file/under/root ) or protocol-relative URL (//can-be-http-or-https.com/ ) will result in a rejected Promise . |
type | Buffer | The FetchResultTypes |
Returns
Promise
<Buffer
>
The return type is determined by the provided type
.
- When using
FetchResultTypes.JSON
then the return type isunknown
by default. The type should be specified by filling in the generic type of the function, or casting the result. - When using
FetchResultTypes.Buffer
the return type will be `Buffer`. - When using
FetchResultTypes.Blob
the return type will be a `Blob`. - When using
FetchResultTypes.Text
the return type will be astring
- When using
FetchResultTypes.Result
the return type will be a `Response` (Response in typescript)
A `Buffer` of the response body
Param
The URL to send the request to. Can be either a string
or an URL
object.
url
should be an absolute url, such as https://example.com/
. A path-relative URL (/file/under/root
) or protocol-relative URL (//can-be-http-or-https.com/
) will result in a rejected Promise
.
Param
The `Request` (RequestInit for TypeScript)
Param
The FetchResultTypes
Call Signature
fetch(
url
:string
|URL
,options
:RequestOptions
,type
:Buffer
):Promise
<Buffer
>
Defined in: projects/utilities/packages/fetch/src/lib/fetch.ts:48
Performs an HTTP(S) fetch
Parameters
Parameter | Type | Description |
---|---|---|
url | string | URL | The URL to send the request to. Can be either a string or an URL object. url should be an absolute url, such as https://example.com/ . A path-relative URL (/file/under/root ) or protocol-relative URL (//can-be-http-or-https.com/ ) will result in a rejected Promise . |
options | RequestOptions | The `Request` (RequestInit for TypeScript) |
type | Buffer | The FetchResultTypes |
Returns
Promise
<Buffer
>
The return type is determined by the provided type
.
- When using
FetchResultTypes.JSON
then the return type isunknown
by default. The type should be specified by filling in the generic type of the function, or casting the result. - When using
FetchResultTypes.Buffer
the return type will be `Buffer`. - When using
FetchResultTypes.Blob
the return type will be a `Blob`. - When using
FetchResultTypes.Text
the return type will be astring
- When using
FetchResultTypes.Result
the return type will be a `Response` (Response in typescript)
A `Buffer` of the response body
Param
The URL to send the request to. Can be either a string
or an URL
object.
url
should be an absolute url, such as https://example.com/
. A path-relative URL (/file/under/root
) or protocol-relative URL (//can-be-http-or-https.com/
) will result in a rejected Promise
.
Param
The `Request` (RequestInit for TypeScript)
Param
The FetchResultTypes
Call Signature
Defined in: projects/utilities/packages/fetch/src/lib/fetch.ts:58
Performs an HTTP(S) fetch
Parameters
Parameter | Type | Description |
---|---|---|
url | string | URL | The URL to send the request to. Can be either a string or an URL object. url should be an absolute url, such as https://example.com/ . A path-relative URL (/file/under/root ) or protocol-relative URL (//can-be-http-or-https.com/ ) will result in a rejected Promise . |
type | Blob | The FetchResultTypes |
Returns
The return type is determined by the provided type
.
- When using
FetchResultTypes.JSON
then the return type isunknown
by default. The type should be specified by filling in the generic type of the function, or casting the result. - When using
FetchResultTypes.Buffer
the return type will be `Buffer`. - When using
FetchResultTypes.Blob
the return type will be a `Blob`. - When using
FetchResultTypes.Text
the return type will be astring
- When using
FetchResultTypes.Result
the return type will be a `Response` (Response in typescript)
A `Blob` of the response body
Param
The URL to send the request to. Can be either a string
or an URL
object.
url
should be an absolute url, such as https://example.com/
. A path-relative URL (/file/under/root
) or protocol-relative URL (//can-be-http-or-https.com/
) will result in a rejected Promise
.
Param
The `Request` (RequestInit for TypeScript)
Param
The FetchResultTypes
Call Signature
fetch(
url
:string
|URL
,options
:RequestOptions
,type
:Blob
):Promise
<Blob
>
Defined in: projects/utilities/packages/fetch/src/lib/fetch.ts:69
Performs an HTTP(S) fetch
Parameters
Parameter | Type | Description |
---|---|---|
url | string | URL | The URL to send the request to. Can be either a string or an URL object. url should be an absolute url, such as https://example.com/ . A path-relative URL (/file/under/root ) or protocol-relative URL (//can-be-http-or-https.com/ ) will result in a rejected Promise . |
options | RequestOptions | The `Request` (RequestInit for TypeScript) |
type | Blob | The FetchResultTypes |
Returns
The return type is determined by the provided type
.
- When using
FetchResultTypes.JSON
then the return type isunknown
by default. The type should be specified by filling in the generic type of the function, or casting the result. - When using
FetchResultTypes.Buffer
the return type will be `Buffer`. - When using
FetchResultTypes.Blob
the return type will be a `Blob`. - When using
FetchResultTypes.Text
the return type will be astring
- When using
FetchResultTypes.Result
the return type will be a `Response` (Response in typescript)
A `Blob` of the response body
Param
The URL to send the request to. Can be either a string
or an URL
object.
url
should be an absolute url, such as https://example.com/
. A path-relative URL (/file/under/root
) or protocol-relative URL (//can-be-http-or-https.com/
) will result in a rejected Promise
.
Param
The `Request` (RequestInit for TypeScript)
Param
The FetchResultTypes
Call Signature
Defined in: projects/utilities/packages/fetch/src/lib/fetch.ts:79
Performs an HTTP(S) fetch
Parameters
Parameter | Type | Description |
---|---|---|
url | string | URL | The URL to send the request to. Can be either a string or an URL object. url should be an absolute url, such as https://example.com/ . A path-relative URL (/file/under/root ) or protocol-relative URL (//can-be-http-or-https.com/ ) will result in a rejected Promise . |
type | Text | The FetchResultTypes |
Returns
Promise
<string
>
The return type is determined by the provided type
.
- When using
FetchResultTypes.JSON
then the return type isunknown
by default. The type should be specified by filling in the generic type of the function, or casting the result. - When using
FetchResultTypes.Buffer
the return type will be `Buffer`. - When using
FetchResultTypes.Blob
the return type will be a `Blob`. - When using
FetchResultTypes.Text
the return type will be astring
- When using
FetchResultTypes.Result
the return type will be a `Response` (Response in typescript)
The response body as a raw string
.
Param
The URL to send the request to. Can be either a string
or an URL
object.
url
should be an absolute url, such as https://example.com/
. A path-relative URL (/file/under/root
) or protocol-relative URL (//can-be-http-or-https.com/
) will result in a rejected Promise
.
Param
The `Request` (RequestInit for TypeScript)
Param
The FetchResultTypes
Call Signature
fetch(
url
:string
|URL
,options
:RequestOptions
,type
:Text
):Promise
<string
>
Defined in: projects/utilities/packages/fetch/src/lib/fetch.ts:90
Performs an HTTP(S) fetch
Parameters
Parameter | Type | Description |
---|---|---|
url | string | URL | The URL to send the request to. Can be either a string or an URL object. url should be an absolute url, such as https://example.com/ . A path-relative URL (/file/under/root ) or protocol-relative URL (//can-be-http-or-https.com/ ) will result in a rejected Promise . |
options | RequestOptions | The `Request` (RequestInit for TypeScript) |
type | Text | The FetchResultTypes |
Returns
Promise
<string
>
The return type is determined by the provided type
.
- When using
FetchResultTypes.JSON
then the return type isunknown
by default. The type should be specified by filling in the generic type of the function, or casting the result. - When using
FetchResultTypes.Buffer
the return type will be `Buffer`. - When using
FetchResultTypes.Blob
the return type will be a `Blob`. - When using
FetchResultTypes.Text
the return type will be astring
- When using
FetchResultTypes.Result
the return type will be a `Response` (Response in typescript)
The response body as a raw string
.
Param
The URL to send the request to. Can be either a string
or an URL
object.
url
should be an absolute url, such as https://example.com/
. A path-relative URL (/file/under/root
) or protocol-relative URL (//can-be-http-or-https.com/
) will result in a rejected Promise
.
Param
The `Request` (RequestInit for TypeScript)
Param
The FetchResultTypes
Call Signature
Defined in: projects/utilities/packages/fetch/src/lib/fetch.ts:100
Performs an HTTP(S) fetch
Parameters
Parameter | Type | Description |
---|---|---|
url | string | URL | The URL to send the request to. Can be either a string or an URL object. url should be an absolute url, such as https://example.com/ . A path-relative URL (/file/under/root ) or protocol-relative URL (//can-be-http-or-https.com/ ) will result in a rejected Promise . |
type | Result | The FetchResultTypes |
Returns
The return type is determined by the provided type
.
- When using
FetchResultTypes.JSON
then the return type isunknown
by default. The type should be specified by filling in the generic type of the function, or casting the result. - When using
FetchResultTypes.Buffer
the return type will be `Buffer`. - When using
FetchResultTypes.Blob
the return type will be a `Blob`. - When using
FetchResultTypes.Text
the return type will be astring
- When using
FetchResultTypes.Result
the return type will be a `Response` (Response in typescript)
The raw `Response` (Response in typescript).
Param
The URL to send the request to. Can be either a string
or an URL
object.
url
should be an absolute url, such as https://example.com/
. A path-relative URL (/file/under/root
) or protocol-relative URL (//can-be-http-or-https.com/
) will result in a rejected Promise
.
Param
The `Request` (RequestInit for TypeScript)
Param
The FetchResultTypes
Call Signature
fetch(
url
:string
|URL
,options
:RequestOptions
,type
:Result
):Promise
<Response
>
Defined in: projects/utilities/packages/fetch/src/lib/fetch.ts:111
Performs an HTTP(S) fetch
Parameters
Parameter | Type | Description |
---|---|---|
url | string | URL | The URL to send the request to. Can be either a string or an URL object. url should be an absolute url, such as https://example.com/ . A path-relative URL (/file/under/root ) or protocol-relative URL (//can-be-http-or-https.com/ ) will result in a rejected Promise . |
options | RequestOptions | The `Request` (RequestInit for TypeScript) |
type | Result | The FetchResultTypes |
Returns
The return type is determined by the provided type
.
- When using
FetchResultTypes.JSON
then the return type isunknown
by default. The type should be specified by filling in the generic type of the function, or casting the result. - When using
FetchResultTypes.Buffer
the return type will be `Buffer`. - When using
FetchResultTypes.Blob
the return type will be a `Blob`. - When using
FetchResultTypes.Text
the return type will be astring
- When using
FetchResultTypes.Result
the return type will be a `Response` (Response in typescript)
The raw `Response` (Response in typescript).
Param
The URL to send the request to. Can be either a string
or an URL
object.
url
should be an absolute url, such as https://example.com/
. A path-relative URL (/file/under/root
) or protocol-relative URL (//can-be-http-or-https.com/
) will result in a rejected Promise
.
Param
The `Request` (RequestInit for TypeScript)
Param
The FetchResultTypes
Call Signature
fetch<
R
>(url
:string
|URL
,options
:RequestOptions
,type
:FetchResultTypes
):Promise
<Response
|Blob
|Buffer
|string
|R
>
Defined in: projects/utilities/packages/fetch/src/lib/fetch.ts:127
Performs an HTTP(S) fetch
Type Parameters
Type Parameter |
---|
R |
Parameters
Parameter | Type | Description |
---|---|---|
url | string | URL | The URL to send the request to. Can be either a string or an URL object. url should be an absolute url, such as https://example.com/ . A path-relative URL (/file/under/root ) or protocol-relative URL (//can-be-http-or-https.com/ ) will result in a rejected Promise . |
options | RequestOptions | The `Request` (RequestInit for TypeScript) |
type | FetchResultTypes | The FetchResultTypes |
Returns
Promise
<Response
| Blob
| Buffer
| string
| R
>
The return type is determined by the provided type
.
- When using
FetchResultTypes.JSON
then the return type isunknown
by default. The type should be specified by filling in the generic type of the function, or casting the result. - When using
FetchResultTypes.Buffer
the return type will be `Buffer`. - When using
FetchResultTypes.Blob
the return type will be a `Blob`. - When using
FetchResultTypes.Text
the return type will be astring
- When using
FetchResultTypes.Result
the return type will be a `Response` (Response in typescript)
The return type is determined by the provided type
.
- When using
FetchResultTypes.JSON
then the return type isunknown
by default. The type should be specified by filling in the generic type of the function, or casting the result. - When using
FetchResultTypes.Buffer
the return type will be `Buffer`. - When using
FetchResultTypes.Blob
the return type will be a `Blob`. - When using
FetchResultTypes.Text
the return type will be astring
- When using
FetchResultTypes.Result
the return type will be a `Response` (Response in typescript)
Param
The URL to send the request to. Can be either a string
or an URL
object.
url
should be an absolute url, such as https://example.com/
. A path-relative URL (/file/under/root
) or protocol-relative URL (//can-be-http-or-https.com/
) will result in a rejected Promise
.
Param
The `Request` (RequestInit for TypeScript)
Param
The FetchResultTypes