I want to catch all XHR request or 301/302 request and get whole response, can we do this with cdp?
Yes, you can.
network.requestWillBeSent event to get the requestId, and store the requestIds you are interested in.network.loadingFinished event to get notified when loading is complete for a request.network.getResponseBody on the requestId to get the raw response bytes.If you want the response headers as well, you should use network.responseReceived. All of these events include a requestId, which is what you should use to associate them.
cool, thanks.
Okay to close this issue then?
Most helpful comment
Yes, you can.
network.requestWillBeSentevent to get the requestId, and store the requestIds you are interested in.network.loadingFinishedevent to get notified when loading is complete for a request.network.getResponseBodyon the requestId to get the raw response bytes.If you want the response headers as well, you should use
network.responseReceived. All of these events include a requestId, which is what you should use to associate them.