Skip to content
/ httpgo Public

🌀 a fast and simple HTTP client library for Go

License

Notifications You must be signed in to change notification settings

voocel/httpgo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

About

🌀 a fast and simple HTTP client library for Go

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages