Unverified Commit cf312226 authored by astaxie's avatar astaxie Committed by GitHub

Merge pull request #3386 from DennisMao/AddTransportSetting

add transport setting
parents 0333e26b 43045760
...@@ -16,6 +16,8 @@ package httplib ...@@ -16,6 +16,8 @@ package httplib
import ( import (
"io/ioutil" "io/ioutil"
"net"
"net/http"
"os" "os"
"strings" "strings"
"testing" "testing"
...@@ -161,7 +163,16 @@ func TestWithSetting(t *testing.T) { ...@@ -161,7 +163,16 @@ func TestWithSetting(t *testing.T) {
var setting BeegoHTTPSettings var setting BeegoHTTPSettings
setting.EnableCookie = true setting.EnableCookie = true
setting.UserAgent = v setting.UserAgent = v
setting.Transport = nil setting.Transport = &http.Transport{
DialContext: (&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
DualStack: true,
}).DialContext,
MaxIdleConns: 50,
IdleConnTimeout: 90 * time.Second,
ExpectContinueTimeout: 1 * time.Second,
}
setting.ReadWriteTimeout = 5 * time.Second setting.ReadWriteTimeout = 5 * time.Second
SetDefaultSetting(setting) SetDefaultSetting(setting)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment