Pass the OkHttpResponse object in onResponse method
See original GitHub issueCould you please provide support for, OkHttpResponse
object will get passed as parameter in onResponse
method of ParsedRequestListener
interface?
In that case, we can get the status code/headers from OkHttpResponse object and still enjoying the parsed object in onResponse
.
For better visualization, my request can be summarized below,
.getAsParsed(new TypeToken<User>() {}, new ParsedRequestListener<User>() {
@Override
public void onResponse(Response response, User user) {
// we can find header like response.headers()
// we can get user as parsed
}
@Override
public void onError(ANError anError) {
// handle error
}
});
Thanks in advance!
P.S: Requested the same feature as a comment in another issue. The issue has been closed. So I am creating a separate issue.
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Can't figure out what to check for in OkHttp's onResponse ...
This is my example project. What is the proper way to handle the onResponse method? public class MainActivity extends AppCompatActivity { ...
Read more >okhttp3.Response.body java code examples - Tabnine
Returns a non-null value if this response was passed to Callback#onResponse or returned from Call#execute(). Response bodies must be ResponseBody and may be ......
Read more >Using OkHttp | CodePath Android Cliffnotes
It passes a Response object that can be used to check the status code, the response body, and any headers that were returned....
Read more >Recipes - OkHttp
The string() method on response body is convenient and efficient for small documents. But if the response body is large (greater than 1...
Read more >OkHttp Android Example Tutorial - DigitalOcean
Asynchronous Calling is the recommneded way since it supports native ... that's a part of OkHttp to define the type of data being...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@tausiq - version 0.2.0 has been released with the features that you had requested.
@tausiq how about this. I am planning to add like below in all requests, this will be an optional listener.