Call

Group
http
Methods
6
Fields
None

Getting one

okHttpClient:newCall(…)
http:get(…)
http:post(…)

Methods

MethodReturnsDescription
cancel()()Cancel it: one in flight completes with onFailure(call, "Canceled"), one not started yet fails so when it is enqueued.
isCanceled()booleanWhether it was cancelled.
isExecuted()booleanWhether it was enqueued.
request()RequestThe request.
clone()CallA new call for the same request, not yet started.
enqueue(any)()Start the request; responseCallback:onResponse(call, response) or :onFailure(call, e) runs on the client thread when it finishes (a tab…

Returned by

MethodReturnsDescription
HttpService.getCallGET url, then callback(response, nil) or callback(nil, message). Returns the call, for cancel().
HttpService.postCallPOST url with body of contentType, then callback(response, err).
OkHttpClient.newCallCallA call for request, not yet started: enqueue starts it.

Method details

cancel

cancel: (Call) -> ()

Cancel it: one in flight completes with onFailure(call, "Canceled"), one not started yet fails so when it is enqueued.

clone

clone: (Call) -> Call

A new call for the same request, not yet started.

enqueue

enqueue: (Call, any) -> ()

Start the request; responseCallback:onResponse(call, response) or :onFailure(call, e) runs on the client thread when it finishes (a table with the two methods). A call runs once: a second enqueue is IllegalStateException: Already Executed.