mirror of
https://github.com/gospider007/requests.git
synced 2025-12-24 13:57:52 +08:00
sync
This commit is contained in:
16
headers.go
16
headers.go
@@ -4,26 +4,12 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/gospider007/tools"
|
||||
"gopkg.in/errgo.v2/fmt/errors"
|
||||
)
|
||||
|
||||
func defaultHeaders() http.Header {
|
||||
return http.Header{
|
||||
"User-Agent": []string{tools.UserAgent},
|
||||
"Connection": []string{"keep-alive"},
|
||||
"Accept": []string{"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"},
|
||||
"Accept-Encoding": []string{"gzip, deflate, br, zstd"},
|
||||
"Accept-Language": []string{tools.AcceptLanguage},
|
||||
"Sec-Ch-Ua": []string{tools.SecChUa},
|
||||
"Sec-Ch-Ua-Mobile": []string{"?0"},
|
||||
"Sec-Ch-Ua-Platform": []string{`"Windows"`},
|
||||
}
|
||||
}
|
||||
|
||||
func (obj *RequestOption) initOrderHeaders() (http.Header, error) {
|
||||
if obj.Headers == nil {
|
||||
return defaultHeaders(), nil
|
||||
return make(http.Header), nil
|
||||
}
|
||||
switch headers := obj.Headers.(type) {
|
||||
case http.Header:
|
||||
|
||||
Reference in New Issue
Block a user