utils/http_utils.go   A
last analyzed

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
cc 1
eloc 12
dl 0
loc 20
ccs 0
cts 7
cp 0
crap 2
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A utils.GetHTMLFromTargetURL 0 11 1
1
package utils
2
3
import (
4
	"io/ioutil"
5
	"net/http"
6
)
7
8
// GetHTMLFromTargetURL makes request to a web page
9
// and returns html string
10
func GetHTMLFromTargetURL(url string) string {
11
	resp, err := http.Get(url)
12
	HandleError(err, "Can't connect to "+url)
13
14
	body, err := ioutil.ReadAll(resp.Body)
15
	HandleError(err, "Can't read body")
16
17
	err = resp.Body.Close()
18
	HandleError(err, "Error while trying to close body")
19
20
	return string(body)
21
}
22