Response

Group
http
Methods
10
Fields
None

Methods

MethodReturnsDescription
code()numberThe status code.
message()stringThe reason phrase.
isSuccessful()booleanWhether the code is 200 to 299.
isRedirect()booleanWhether the code is a redirect (300, 301, 302, 303, 307, 308): one OkHttp did not follow.
header(string, string?)string?(Response, string) -> string?: The last value of header name, any case, or nil.
headers(string){string}Every value of header name, in order.
body()ResponseBody?The body (readable once).
request()RequestThe request that answered (after redirects, its URL is the final one).
close()()Close the body: it cannot be read after.
toString()stringResponse{protocol=http/1.1, code=200, message=OK, url=...}.

Method details

isRedirect

isRedirect: (Response) -> boolean

Whether the code is a redirect (300, 301, 302, 303, 307, 308): one OkHttp did not follow.

headers

headers: (Response, string) -> {string}

Every value of header name, in order.

close

close: (Response) -> ()

Close the body: it cannot be read after.

toString

toString: (Response) -> string

Response{protocol=http/1.1, code=200, message=OK, url=...}.