kohttp / io.github.rybalkinsd.kohttp.ext / kotlin.String / httpGet

httpGet

fun String.httpGet(client: Factory = defaultHttpClient): Response

This extension performs an GET request with the provided String url.

Parameters

client - gives a possibility to provide your implementation of HttpClient defaultHttpClient by default

Return

a Response instance

Instances of this class are not immutable: the response body is a one-shot value that may be consumed only once and then closed. All other properties are immutable.

Usage example: val response = "http://host:port/path/?a=b".httpGet() response.use { your code here }

Since
0.1.0

Author
sergey