HttpClient
Constructors
Link copied to clipboard
constructor(userAgent: String = definedExternally, handlers: ReadonlyArray<RequestHandler> = definedExternally, requestOptions: RequestOptions = definedExternally)
Functions
Link copied to clipboard
fun del(requestUrl: String, additionalHeaders: OutgoingHttpHeaders = definedExternally): Promise<HttpClientResponse>
Link copied to clipboard
fun get(requestUrl: String, additionalHeaders: OutgoingHttpHeaders = definedExternally): Promise<HttpClientResponse>
Link copied to clipboard
Link copied to clipboard
fun <T> getJson(requestUrl: String, additionalHeaders: OutgoingHttpHeaders = definedExternally): Promise<TypedResponse<T>>
Gets a typed object from an endpoint Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise
Link copied to clipboard
fun head(requestUrl: String, additionalHeaders: OutgoingHttpHeaders = definedExternally): Promise<HttpClientResponse>
Link copied to clipboard
fun options(requestUrl: String, additionalHeaders: OutgoingHttpHeaders = definedExternally): Promise<HttpClientResponse>
Link copied to clipboard
fun patch(requestUrl: String, data: String, additionalHeaders: OutgoingHttpHeaders = definedExternally): Promise<HttpClientResponse>
Link copied to clipboard
fun <T> patchJson(requestUrl: String, obj: Any?, additionalHeaders: OutgoingHttpHeaders = definedExternally): Promise<TypedResponse<T>>
Link copied to clipboard
fun post(requestUrl: String, data: String, additionalHeaders: OutgoingHttpHeaders = definedExternally): Promise<HttpClientResponse>
Link copied to clipboard
fun <T> postJson(requestUrl: String, obj: Any?, additionalHeaders: OutgoingHttpHeaders = definedExternally): Promise<TypedResponse<T>>
Link copied to clipboard
fun put(requestUrl: String, data: String, additionalHeaders: OutgoingHttpHeaders = definedExternally): Promise<HttpClientResponse>
Link copied to clipboard
fun <T> putJson(requestUrl: String, obj: Any?, additionalHeaders: OutgoingHttpHeaders = definedExternally): Promise<TypedResponse<T>>
Link copied to clipboard
fun request(verb: String, requestUrl: String, data: String?, headers: OutgoingHttpHeaders = definedExternally): Promise<HttpClientResponse>
Makes a raw http request. All other methods such as get, post, patch, and request ultimately call this. Prefer get, del, post and patch
fun request(verb: String, requestUrl: String, data: ReadableStream?, headers: OutgoingHttpHeaders = definedExternally): Promise<HttpClientResponse>
Link copied to clipboard
Raw request.
Link copied to clipboard
fun requestRawWithCallback(info: RequestInfo, data: String?, onResult: (JsError?, res: HttpClientResponse?) -> Unit)
Raw request with callback.
fun requestRawWithCallback(info: RequestInfo, data: ReadableStream?, onResult: (JsError?, res: HttpClientResponse?) -> Unit)
Link copied to clipboard
fun sendStream(verb: String, requestUrl: String, stream: ReadableStream, additionalHeaders: OutgoingHttpHeaders = definedExternally): Promise<HttpClientResponse>