mirror of
https://github.com/gospider007/requests.git
synced 2025-12-24 13:57:52 +08:00
sync
This commit is contained in:
11
headers.go
11
headers.go
@@ -1,6 +1,7 @@
|
||||
package requests
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
@@ -20,10 +21,16 @@ func (obj *RequestOption) initHeaders() (http.Header, error) {
|
||||
case http.Header:
|
||||
return headers.Clone(), nil
|
||||
default:
|
||||
_, dataMap, _, err := obj.newBody(headers, mapType)
|
||||
if dataMap == nil || err != nil {
|
||||
body, dataMap, _, err := obj.newBody(headers, mapType)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if body != nil {
|
||||
return nil, errors.New("headers type error")
|
||||
}
|
||||
if dataMap == nil {
|
||||
return nil, nil
|
||||
}
|
||||
head, order := dataMap.parseHeaders()
|
||||
obj.OrderHeaders = order
|
||||
return head, err
|
||||
|
||||
Reference in New Issue
Block a user