get
Fetches a resource from the specified URL and returns the response as text, JSON, or a base64-encoded string depending on the provided mode. This function performs an asynchronous network request and throws an error if the response status is not successful.
def get(
url: string,
mode: string
) - > string|object
Fetches a resource from the specified URL and processes the response body based on the requested mode.
Parameters
| Name | Type | Description |
|---|---|---|
| url | string | The absolute or relative URL of the resource to fetch. |
| mode | string | Determines the parsing strategy for the response: 'text' for plain text, 'json' for object parsing, or any other value for Base64-encoded binary data. |
Returns
| Type | Description |
|---|---|
| `string | object` |