Skip to content

aisbreaker-api-js - v0.1.15 / utils/KyHttpClientUtils

Module: utils/KyHttpClientUtils

Table of contents

Functions

Functions

kyHooksBeforeErrorToReduceLogging

kyHooksBeforeErrorToReduceLogging(debug?): (error: HTTPError) => Promise<HTTPError>[]

Parameters

NameType
debug?boolean

Returns

(error: HTTPError) => Promise<HTTPError>[]

Defined in

aisbreaker-js/packages/aisbreaker-api-js/src/utils/KyHttpClientUtils.ts:100


kyHooksToReduceLogging

kyHooksToReduceLogging(debug?): Object

Default hook for ky.*()

Reduce logging spam by deleting some ky error details in the case of an HTTPError

Parameters

NameType
debug?boolean

Returns

Object

NameType
beforeError(error: HTTPError) => Promise<HTTPError>[]

Defined in

aisbreaker-js/packages/aisbreaker-api-js/src/utils/KyHttpClientUtils.ts:94


kyOnDownloadProgress4onMessage

kyOnDownloadProgress4onMessage(onMessage): (progress: DownloadProgress, chunk: Uint8Array) => void

Mapping onMessage() event handler to onDownloadProgress(). Useful for ky.post() / onDownloadProgress

Parameters

NameType
onMessage(message: EventSourceMessage) => void

Returns

fn

▸ (progress, chunk): void

Parameters
NameType
progressDownloadProgress
chunkUint8Array
Returns

void

Defined in

aisbreaker-js/packages/aisbreaker-api-js/src/utils/KyHttpClientUtils.ts:60


tryToCreateAIsErrorFromKyResponse

tryToCreateAIsErrorFromKyResponse(response): Promise<AIsError | undefined>

Throws an AIsError if the response contains an error, otherwise it just returns

Parameters

NameTypeDescription
responseanyky response, potenially with an JSON-encoded AIsError

Returns

Promise<AIsError | undefined>

the AIsError if the response contains an error, otherwise undefined

Defined in

aisbreaker-js/packages/aisbreaker-api-js/src/utils/KyHttpClientUtils.ts:145

Released under the MIT License.