Methods
(inner) appendParams(uri, paramsnon-null) → {String}
Appends query parameters to a URI.
Parameters:
| Name | Type | Description |
|---|---|---|
uri |
String | The original URI, which may already have query data. |
params |
Object | An object where keys are URI-encoded parameter keys, and the values are arbitrary types or arrays. |
Returns:
The new URI.
- Type
- String
(package, inner) checkHttpStatusIsOk(response) → {Response}
Checks HTTP status of fetch response, if OK return response else throw an Error with details
Parameters:
| Name | Type | Description |
|---|---|---|
response |
Response | Response instance returned by fetch |
Throws:
-
Error instance with
address(URL),errno(HTTP status) andinfo(HTTP status text) - Type
- Error
Returns:
Response instance with OK HTTP status
- Type
- Response
(inner) normalize(strArray) → {String}
Normalize URL parts
Parameters:
| Name | Type | Description |
|---|---|---|
strArray |
Array.<String> | List of parts to join into a valid URL |
Returns:
Joined URL
- Type
- String
(inner) urlJoin(…args) → {String}
Join parts of a URL into a valid URL
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
args |
String |
<repeatable> |
Parts of the URL to join |
Returns:
Joined URL
- Type
- String
(inner) buildUrl(baseUrl, path, qs) → {URL}
Create a URL instance
Parameters:
| Name | Type | Description |
|---|---|---|
baseUrl |
string | Base URL |
path |
string | Path to append to baseUrl |
qs |
object | Object containing properties that will be appended to searchParams |
Returns:
URL instance
- Type
- URL