aboutsummaryrefslogtreecommitdiff
path: root/internal/httplib/httplib.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/httplib/httplib.go')
-rw-r--r--internal/httplib/httplib.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/internal/httplib/httplib.go b/internal/httplib/httplib.go
index 1062d220..142eb7c5 100644
--- a/internal/httplib/httplib.go
+++ b/internal/httplib/httplib.go
@@ -27,9 +27,11 @@ import (
jsoniter "github.com/json-iterator/go"
)
-var defaultSetting = Settings{false, "GogsServer", 60 * time.Second, 60 * time.Second, nil, nil, nil, false}
-var defaultCookieJar http.CookieJar
-var settingMutex sync.Mutex
+var (
+ defaultSetting = Settings{false, "GogsServer", 60 * time.Second, 60 * time.Second, nil, nil, nil, false}
+ defaultCookieJar http.CookieJar
+ settingMutex sync.Mutex
+)
// createDefaultCookie creates a global cookiejar to store cookies.
func createDefaultCookie() {
@@ -270,7 +272,7 @@ func (r *Request) getResponse() (*http.Response, error) {
if err != nil {
log.Fatal(err)
}
- //iocopy
+ // iocopy
_, err = io.Copy(fileWriter, fh)
_ = fh.Close()
if err != nil {
@@ -437,7 +439,7 @@ func (r *Request) Response() (*http.Response, error) {
}
// TimeoutDialer returns functions of connection dialer with timeout settings for http.Transport Dial field.
-func TimeoutDialer(cTimeout time.Duration, rwTimeout time.Duration) func(ctx context.Context, net, addr string) (c net.Conn, err error) {
+func TimeoutDialer(cTimeout, rwTimeout time.Duration) func(ctx context.Context, net, addr string) (c net.Conn, err error) {
return func(ctx context.Context, netw, addr string) (net.Conn, error) {
conn, err := net.DialTimeout(netw, addr, cTimeout)
if err != nil {