0

I am working with some existing code that makes RxJava/ Retrofit calls to get bunch data using Http calls.

I have a requirement to get full HTTP responses on retail builds. - basically whatever is the webserver response string on the wire. I can get this with Retrofit on debug builds using

RestAdapter.Builder builder = new RestAdapter.Builder()
            .setEndpoint(endpoint)
            .setLogLevel(RestAdapter.LogLevel.FULL); 

I don't know how to get this on retail builds.

I know that we can get this using Volley's StringRequest.

Given that tons of people use RxJava, I am wondering how people deal with this.

Appreciate any help. -Thanks

techtinkerer
  • 1,280
  • 2
  • 15
  • 26
  • Retrofit relies on OkHttp for the HTTP part of the request, therefore you should read about HTTP interceptors. Here's an example: http://stackoverflow.com/a/35198633/2684 (tho it's Retrofit 2.0, the idea is very similar and/or at least, it's in the exact same direction). – Martin Marconcini Apr 06 '17 at 00:57
  • Possible duplicate of [Getting Request body content using Retrofit 2.0 POST method](http://stackoverflow.com/questions/35187199/getting-request-body-content-using-retrofit-2-0-post-method) – Martin Marconcini Apr 06 '17 at 00:57
  • these libraries as Rx are pretty bad in the sense that so much stuff is undercovers and we need to dig quite deep to get the darn plan http response as a string. – techtinkerer Apr 06 '17 at 08:18
  • Agreed, welcome to Java, where there must be at least 10 "patterns" that involve 20 interfaces and 20 "impl" objects so it looks nice like in the books. – Martin Marconcini Apr 06 '17 at 16:04
  • yet, there is so much craze to go to RxJava. I am just getting my head wrapped around it. But the basic need to get a full http response as on the wire is so difficult. Perhaps I should to switch something like Volley. What do you think? – techtinkerer Apr 06 '17 at 18:37
  • Not really, my question to you is… why do you need the body is such a "primitive" state? (String) RX/Retrofit make it very easy to deal with high level stuff (which is probably 99% of the times what you need). RXJava is huge, take it step by step :) – Martin Marconcini Apr 06 '17 at 19:46
  • my team wants to log the entire HTTP requests/responses. Basically, the tech server support guy wants to know full details when things go wrong. It will be in production under hidden covers. - Not my choice. CharlesProxy will help for that,but it's their choice and I am here to execute it. – techtinkerer Apr 06 '17 at 20:52
  • Well, we get paid to write this stuff so… good luck with that :-) (but yeah, an interceptor will do) – Martin Marconcini Apr 06 '17 at 21:20

0 Answers0