utils.GetHTMLFromTargetURL   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 11
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 8
nop 1
dl 0
loc 11
ccs 0
cts 7
cp 0
crap 2
rs 10
c 0
b 0
f 0
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