add new client

This commit is contained in:
yanghao05
2023-05-12 20:02:29 +08:00
parent 630a78529e
commit 0fc585e077
7 changed files with 1294 additions and 2 deletions

View File

@@ -0,0 +1,35 @@
package httpclient
import (
"github.com/rogeecn/atom/container"
"github.com/rogeecn/atom/providers/http"
"github.com/rogeecn/atom/utils/opt"
)
const DefaultPrefix = "HttpClient"
func DefaultProvider() container.ProviderContainer {
return container.ProviderContainer{
Provider: Provide,
Options: []opt.Option{
opt.Prefix(http.DefaultPrefix),
},
}
}
type Config struct {
DevMode bool
CookieJarFile string
RootCa []string
UserAgent string
InsecureSkipVerify bool
CommonHeaders map[string]string
Timeout uint
AuthBasic struct {
Username string
Password string
}
AuthBearerToken string
ProxyURL string
RedirectPolicy []string // "Max:10;No;SameDomain;SameHost;AllowedHost:x,x,x,x,x,AllowedDomain:x,x,x,x,x"
}