1

I am using goquery to get the DOM of a webpage. I tried looking into the godocs but I'm not sure why I get this error:

All I'm trying to do here is fetching a webpage content in a url.

snippet:

response, err := http.Get(somedotcom)
doc, err := goquery.NewDocumentFromReader(response.Body)
if err != nil {
    panic(err) // the panic is coming from here
} else {
    return doc
}

output:

panic: stream error: stream ID 1; PROTOCOL_ERROR
  • Have you checked the content of `response.Body`? You can read it with `ioutil.ReadAll`. But beware that after the body is read and you cannot use it any more. – TehSphinX Apr 20 '19 at 12:34
  • Can you provide more code context about where `response.Body` is coming from and what you already did with it? – TehSphinX Apr 20 '19 at 12:37

0 Answers0