repositorypackage
0.0.0-20231109151731-2b581f752156
Repository: https://github.com/voocel/httpgo.git
Documentation: pkg.go.dev
# README
httpgo
A fast and simple go http client
⚙️ Installation
go get -u github.com/voocel/httpgo
👀 Examples
📖GET
res, err := httpgo.Get("http://www.google.com").Do()
📖POST
res, err := httpgo.Post("http://www.google.com").Do()
📖SetTimeout
res, err := httpgo.Get("http://www.google.com").SetTimeout(5 * time.Second).Do()
📖Middleware
var l *log.logger
c := httpgo.NewHttpClient(WithLogger(l))
res, err := c.Get("http://www.google.com").Do()
res, err := c.Post("http://www.google.com").Do()
🔥 Supported Methods
- SetQuery(
key, value string
) - SetQueries(
m map[string]string
) - SetForm(
m map[string]string
) - SetJSON(
v string
) - SetText(
v string
) - SetFile(
fieldname, filename string
) - SetTimeout(
t time.Duration
) - SetHeader(
key, value string
) - SetHeaders(
m map[string]string
) - AddHeader(
key, value string
) - AddHeaders(
m map[string]string
) - SetUA(
ua string
) - AddCookie(
c *http.Cookie
) - BasicAuth(
username, password string
) - Upload(
fieldname, filename string
)