Response header bug fixed for Chrome
This commit is contained in:
parent
ec83a92eb3
commit
c28b228a12
@ -265,6 +265,7 @@ func (g *Geziyor) doRequestChrome(req *Request) (*Response, error) {
|
|||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
var body string
|
var body string
|
||||||
|
var reqID network.RequestID
|
||||||
var res *network.Response
|
var res *network.Response
|
||||||
|
|
||||||
if err := chromedp.Run(ctx,
|
if err := chromedp.Run(ctx,
|
||||||
@ -273,8 +274,14 @@ func (g *Geziyor) doRequestChrome(req *Request) (*Response, error) {
|
|||||||
chromedp.ActionFunc(func(ctx context.Context) error {
|
chromedp.ActionFunc(func(ctx context.Context) error {
|
||||||
chromedp.ListenTarget(ctx, func(ev interface{}) {
|
chromedp.ListenTarget(ctx, func(ev interface{}) {
|
||||||
switch ev.(type) {
|
switch ev.(type) {
|
||||||
|
case *network.EventRequestWillBeSent:
|
||||||
|
if reqEvent := ev.(*network.EventRequestWillBeSent); reqEvent.Request.URL == req.URL.String() {
|
||||||
|
reqID = reqEvent.RequestID
|
||||||
|
}
|
||||||
case *network.EventResponseReceived:
|
case *network.EventResponseReceived:
|
||||||
res = ev.(*network.EventResponseReceived).Response
|
if resEvent := ev.(*network.EventResponseReceived); resEvent.RequestID == reqID {
|
||||||
|
res = resEvent.Response
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user