fix(request): deep copy shared header object in request options

This commit is contained in:
HFO4
2022-10-15 16:16:17 +08:00
parent c7dc143d30
commit 8494bd6eb9
4 changed files with 8 additions and 2 deletions

View File

@@ -56,7 +56,7 @@ func NewClient(opts ...Option) Client {
func (c *HTTPClient) Request(method, target string, body io.Reader, opts ...Option) *Response {
// 应用额外设置
c.mu.Lock()
options := *c.options
options := c.options.clone()
c.mu.Unlock()
for _, o := range opts {
o.apply(&options)