Request creation simplified and basic auth test added.

This commit is contained in:
Musab Gültekin
2019-06-17 13:53:34 +03:00
parent a5ec28664d
commit 4177f10de9
4 changed files with 27 additions and 6 deletions

View File

@ -4,7 +4,6 @@ import (
"errors"
"net"
"net/http"
"net/http/cookiejar"
"net/url"
"time"
)
@ -20,7 +19,7 @@ type Client struct {
}
// NewClient creates http.Client with modified values for typical web scraper
func NewClient(cookiesDisabled bool) *Client {
func NewClient() *Client {
client := &http.Client{
Transport: &http.Transport{
Proxy: http.ProxyFromEnvironment,
@ -37,9 +36,6 @@ func NewClient(cookiesDisabled bool) *Client {
},
Timeout: time.Second * 180, // Google's timeout
}
if !cookiesDisabled {
client.Jar, _ = cookiejar.New(nil)
}
return &Client{Client: client}
}