|
|
@ -10,10 +10,11 @@ func loadWebPage(webURL string) ([]byte, error) { |
|
|
|
resp, err := http.Get(webURL) |
|
|
|
resp, err := http.Get(webURL) |
|
|
|
//reads html as a slice of bytes
|
|
|
|
//reads html as a slice of bytes
|
|
|
|
html, err := ioutil.ReadAll(resp.Body) |
|
|
|
html, err := ioutil.ReadAll(resp.Body) |
|
|
|
|
|
|
|
defer resp.Body.Close() |
|
|
|
|
|
|
|
|
|
|
|
//check response codes
|
|
|
|
//check response codes
|
|
|
|
if resp.StatusCode >= 400 && resp.StatusCode <= 499 { |
|
|
|
if resp.StatusCode >= 400 && resp.StatusCode <= 499 { |
|
|
|
err = fmt.Errorf("response Code: %v", resp.StatusCode) |
|
|
|
err = fmt.Errorf("got response code %v", resp.StatusCode) |
|
|
|
} |
|
|
|
} |
|
|
|
return html, err |
|
|
|
return html, err |
|
|
|
|
|
|
|
|
|
|
|