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

Is there a way to get the raw bytes of a response? #12

Closed
molant opened this issue Apr 27, 2017 · 3 comments
Closed

Is there a way to get the raw bytes of a response? #12

molant opened this issue Apr 27, 2017 · 3 comments

Comments

@molant
Copy link

molant commented Apr 27, 2017

For example, if the content is gzipped is there any way I can access the raw bytes? getResponseBody only seems to return a string and other events like dataReceived, etc. don't seem to have that data :(

@ghost
Copy link

ghost commented Apr 30, 2017

You should first listen Network.responseReceived event to find requestId and then invoke Network.getResponseBody command to get response body.

If you need Java based solution, please review this sample code.

Finally do not forget to call Network.enable command to listen Network events.

@molant
Copy link
Author

molant commented Jun 7, 2017

Thanks @ui4j, but unfortunately this isn't exactly what I need.
Whenever I do a Network.getResonseBody I get the body text, not the original compressed bytes (if they were compressed).
Also when the response isn't text (like images) I get the following response (which is not very useful):

{
  "body": "",
  "base64Encoded": true
}

I'm using chrome remote interface but it doesn't seem to be a problem with it :(

@paulirish
Copy link
Member

AFAIK we don't have support for this now and no immediate plans to implement. cc @allada
Network responses are decoded in the Chromium /net layer a bit earlier than our instrumentation starts, so it's some effort to get the data.

Also unimplemented, but if the protocol exposed a way to set a proxy, then you could run a network proxy to grab these bytes. In the future, it's possible a .setProxy() method might surface, though I've only seen this person mention working on it. ¯\(ツ)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants