Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Volley stetho network #51

Closed
wants to merge 1 commit into from

Conversation

briangriffey
Copy link

No description provided.

@jasta
Copy link
Contributor

jasta commented Feb 20, 2015

I think there's a much easier way to do this by subclassing the two HttpStack implementations or maybe even easier by just creating a StethoWrappingHttpStack.

Also, prefer using Volley through Maven coordinates. We don't currently bundle any jar files.

@briangriffey
Copy link
Author

Extending HurlStack might be possible. That private static entityFromConnection might prove painful when trying to read the inputstream.

@jasta
Copy link
Contributor

jasta commented Feb 20, 2015

As I think about this more, I think wrapping HttpStack is more flexible and simpler.  This can be done by replacing the entity like:

  public HttpResponse performRequest(...) {
    mNetworkEventReporter.requestWillBeSent(new VolleyInspectorRequest(request));
    response = mDelegate.performRequest(request);
    mNetworkEventReporter.receivedResponseHeaders(...);
    InputStream intercepted = mNetworkEventReporter.interpretResponseStream(...);
    response.setEntity(new InputStreamEntity(intercepted));
    return response;
  }

This should make it possible to do:

new StethoInterceptingHttpStack(new HurlStack(...));

The critical assumption with this approach is that performRequest didn't already read the response input stream. I don't think it would, though.

@jasta
Copy link
Contributor

jasta commented Feb 20, 2015

Just saw #43 which might be of interest to you as well. This is a slightly different take on the solution if you use OkHttp.

@briangriffey
Copy link
Author

Yea, I just think this is the only connection agnostic method to integrating with volley. Still allows you to use OkHttp or UrlConnection or HttpClient under the hood. This sits on the layer right above that.

@jasta
Copy link
Contributor

jasta commented Feb 20, 2015

@briangriffey agreed, I think the HttpStack wrapper works nicely for that reason too.

@jasta
Copy link
Contributor

jasta commented Mar 24, 2015

Any update? I'd really love to have good Volley support for Stetho...

@briangriffey
Copy link
Author

Sorry, end of the quarter is happening. I'll circle back to this beginning of April.

@gfx
Copy link

gfx commented Apr 17, 2015

👀

@milek
Copy link

milek commented May 4, 2015

Any update on that pull request?

@condemoreloer
Copy link

brian@briangriffey.com
Ledo un gouache.

@vaurdan
Copy link

vaurdan commented Jun 4, 2015

Any news on this one? It is possible to use Stetho with Volley?

@jasta
Copy link
Contributor

jasta commented Jun 5, 2015

@vaurdan yes it's always been possible to use Stetho with Volley it just requires you jump through some hoops. The easiest way is to use OkHttp with Volley and install this implementation into Volley: https://gist.github.com/bryanstern/4e8f1cb5a8e14c202750

This works great actually, it's just not as discoverable/convenient as we'd like. It also doesn't work if you use Volley with HttpURLConnection :\

@vaurdan
Copy link

vaurdan commented Jun 5, 2015

@jasta Oh! Thanks for the tip, I've now Stetho working with Volley using the OkHttp! 👍

@YusukeIwaki
Copy link

With stetho-volley, NullPointerException occurs when the response code is 204.

Applying the patch below is required.
https://android.googlesource.com/platform/frameworks/volley/+/e8f5353b17aea6659dc3aa13223317b484d01483%5E%21/src/com/android/volley/toolbox/BasicNetwork.java

@ghost ghost added the CLA Signed label Jul 12, 2016
@beilly
Copy link

beilly commented Oct 11, 2016

Thanks to (http://www.littlerobots.nl/blog/stetho-for-android-debug-builds-only/ )[http://www.littlerobots.nl/blog/stetho-for-android-debug-builds-only/ ].I've now Stetho working with Volley using the OkHttp in my debug build, but using Volley alone in release! 👍

@jasta
Copy link
Contributor

jasta commented Dec 28, 2017

Ancient pull request and really isn't everyone just using OkHttp now? :)

@jasta jasta closed this Dec 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants