This commit is contained in:
gospider
2025-02-28 21:00:17 +08:00
parent 8c02757e99
commit 7db53c2417
5 changed files with 8 additions and 40 deletions

View File

@@ -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: