From 284974b56dd877fedd3bb72a8ed53fd2ceb82130 Mon Sep 17 00:00:00 2001 From: Jerry <85411418@qq.com> Date: Mon, 8 Mar 2021 14:56:12 +0800 Subject: [PATCH] v1.5.32 --- constant.go | 2 +- pkg/xhttp/client.go | 8 +++++--- release_note.txt | 4 ++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/constant.go b/constant.go index 4a3dbfd8..96053c66 100644 --- a/constant.go +++ b/constant.go @@ -7,7 +7,7 @@ const ( OK = "OK" DebugOff = 0 DebugOn = 1 - Version = "1.5.31" + Version = "1.5.32" ) type DebugSwitch int8 diff --git a/pkg/xhttp/client.go b/pkg/xhttp/client.go index 954db38c..399659dc 100644 --- a/pkg/xhttp/client.go +++ b/pkg/xhttp/client.go @@ -135,7 +135,7 @@ func NewClient() (client *Client) { DisableKeepAlives: true, }, }, - Transport: &http.Transport{}, + Transport: nil, Header: make(http.Header), requestType: TypeUrlencoded, unmarshalType: string(TypeJSON), @@ -146,7 +146,7 @@ func NewClient() (client *Client) { func (c *Client) SetTLSConfig(tlsCfg *tls.Config) (client *Client) { c.mu.Lock() - c.Transport.TLSClientConfig = tlsCfg + c.Transport = &http.Transport{TLSClientConfig: tlsCfg, DisableKeepAlives: true} c.mu.Unlock() return c } @@ -383,7 +383,9 @@ func (c *Client) EndBytes() (res *http.Response, bs []byte, errs []error) { } req.Header = c.Header req.Header.Set("Content-Type", c.ContentType) - c.HttpClient.Transport = c.Transport + if c.Transport != nil { + c.HttpClient.Transport = c.Transport + } return req, nil }() if err != nil { diff --git a/release_note.txt b/release_note.txt index ad7ede7b..265f81e9 100644 --- a/release_note.txt +++ b/release_note.txt @@ -1,3 +1,7 @@ +版本号:Release 1.5.32 +修改记录: + (1) xhttp:Fix bug about Transport + 版本号:Release 1.5.31 修改记录: (1) 微信:新增服务商支付接口