diff options
| author | Teddy Wing | 2017-03-11 08:33:39 +0100 | 
|---|---|---|
| committer | Teddy Wing | 2017-03-11 08:33:39 +0100 | 
| commit | d14b4bb9be46396843c346b468dada938364c25b (patch) | |
| tree | 8952bc2695f80487628122d7f5d238a5827cc1ed /timetask | |
| download | timetasker-d14b4bb9be46396843c346b468dada938364c25b.tar.bz2 | |
Initial commit. Test HTTP request.
Make a sample GET request using `net/http`.
Diffstat (limited to 'timetask')
| -rw-r--r-- | timetask/http.go | 11 | ||||
| -rw-r--r-- | timetask/http_test.go | 14 | 
2 files changed, 25 insertions, 0 deletions
| diff --git a/timetask/http.go b/timetask/http.go new file mode 100644 index 0000000..ae2fdc4 --- /dev/null +++ b/timetask/http.go @@ -0,0 +1,11 @@ +package timetask + +import ( +	// "mime/multipart" +	"net/http" +) + +func Login() (resp *http.Response, err error) { +	resp, err = http.Get("https://duckduckgo.com") +	return resp, err +} diff --git a/timetask/http_test.go b/timetask/http_test.go new file mode 100644 index 0000000..7adf2c4 --- /dev/null +++ b/timetask/http_test.go @@ -0,0 +1,14 @@ +package timetask + +import ( +	"io/ioutil" +	"testing" +) + +func TestLogin(t *testing.T) { +	response, _ := Login() +	defer response.Body.Close() +	body, _ := ioutil.ReadAll(response.Body) +	t.Log(response) +	t.Logf("%s", body) +} | 
