code
code: (Response) -> numberThe status code.
| Method | Returns | Description |
|---|---|---|
code() | number | The status code. |
message() | string | The reason phrase. |
isSuccessful() | boolean | Whether the code is 200 to 299. |
isRedirect() | boolean | Whether 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() | Request | The request that answered (after redirects, its URL is the final one). |
close() | () | Close the body: it cannot be read after. |
toString() | string | Response{protocol=http/1.1, code=200, message=OK, url=...}. |
codecode: (Response) -> numberThe status code.
messagemessage: (Response) -> stringThe reason phrase.
isSuccessfulisSuccessful: (Response) -> booleanWhether the code is 200 to 299.
isRedirectisRedirect: (Response) -> booleanWhether the code is a redirect (300, 301, 302, 303, 307, 308): one OkHttp did not follow.
headerheader: (Response, string, string?) -> string?(Response, string) -> string?: The last value of header name, any case, or nil.
(Response, string, string?) -> string?: The last value of header name, or defaultValue.
headersheaders: (Response, string) -> {string}Every value of header name, in order.
bodybody: (Response) -> ResponseBody?The body (readable once).
requestrequest: (Response) -> RequestThe request that answered (after redirects, its URL is the final one).
closeclose: (Response) -> ()Close the body: it cannot be read after.
toStringtoString: (Response) -> stringResponse{protocol=http/1.1, code=200, message=OK, url=...}.