Home Reference Source

References

summary

Builder of fetch call with a functionnal design.

C funtch

funtch functional interface

F doFetch(url: String, params: Object, error: Function, content: Function): Promise

Perform fetch operation from given params.

F errorHandler(response: Object, content: Function): Promise<Object>

Identify and handle error from response

F isJson(body: String): Boolean

Check if content is JSON by trying to parse it

F readContent(response: Object): Promise<Object>

Read content from response according to ContentType Header (text or JSON)

F readHeaders(response: Object): Object

Read all headers from response

F stringify(obj: Object, replacer: Function, space: String): String

Safe JSON.stringify

V ACCEPT_TYPE_HEADER: String

Accept header name.

Authorization header name.

ContentType header name.

V CONTENT_TYPE_JSON: RegExp

RegExp for checking if content type reference JSON.

V MEDIA_TYPE_JSON: String

JSON Media Type

V MEDIA_TYPE_TEXT: String

Plain text Media Type