okhttp

Since 1.5.0

Constants

MultipartBody : map = MultipartBodyValue

RequestBody : map = RequestBodyValue

okhttp : map = OkHttpValue

Types

CallValue

Functions

cancel()

enqueue(onResponse, onFailure=def(call, errorMessage))

execute()

isCanceled()

isExecuted()

MultipartBodyValue

Functions

builder() — returns MultipartBodyBuilderValue

MultipartBodyBuilderValue

Functions

addFormData(data)

addFormDataPart(name, value, requestBody = empty)

addPart(requestBody, headers = {})

build() — creates and returns MultipartBodyValue

setType(type)

RequestBuilderValue

Functions

addHeader(name, value)

cacheControl()

delete(requestBody = empty)

get()

head()

header(name, value)

headers(headersMap)

method(method, requestBody = empty)

newCall(client) — creates new call, returns CallValue

patch(requestBody = empty)

post(requestBody = empty)

put(requestBody = empty)

removeHeader(name)

url(url)

RequestBodyValue

Functions

bytes(contentType, bytes, offset = 0, bytesCount = bytes.length)

file(contentType, filePath)

string(contentType, content)

OkHttpValue

Functions

request() — returns RequestBuilderValue

newClient() — returns HttpClientBuilderValue

HttpClientValue

Functions

connectTimeoutMillis()

followRedirects()

followSslRedirects()

newCall(request) — creates new call, returns CallValue

newWebSocket(request, callbacks)

pingIntervalMillis()

readTimeoutMillis()

retryOnConnectionFailure()

writeTimeoutMillis()

HttpClientBuilderValue

Functions

callTimeout(duration, timeUnit) — Sets call timeout for duration and timeUnit one of "millis"/"milliseconds", "seconds", "minutes", "hours", "days"

connectTimeout(duration, timeUnit) — Sets connect timeout for duration and timeUnit one of "millis"/"milliseconds", "seconds", "minutes", "hours", "days"

readTimeout(duration, timeUnit) — Sets read timeout for duration and timeUnit one of "millis"/"milliseconds", "seconds", "minutes", "hours", "days"

writeTimeout(duration, timeUnit) — Sets write timeout for duration and timeUnit one of "millis"/"milliseconds", "seconds", "minutes", "hours", "days"

retryOnConnectionFailure(flag) — Enables or disables retry on connection failure

build() — Returns new HttpClientValue