Skip to content
/ http Public

🎈 HTTP client with a clean API.

License

Notifications You must be signed in to change notification settings

aerogo/http

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

http

Godoc Report Tests Coverage Sponsor

Provides HTTP utilities. Currently it offers a fast and easy-to-use HTTP client.

Installation

go get github.com/aerogo/http/client

Request

Basic GET request

response, err := client.Get("https://example.com").End()

Other HTTP methods

client.Post("https://example.com/user/1").End()
client.Put("https://example.com/user/1").End()
client.Delete("https://example.com/user/1").End()

Sending request headers

response, err := client.Get("https://example.com").Header("Accept", "text/html").End()

Response

Response body as bytes

response.Bytes()

Response body as a string

response.String()

Status code

response.StatusCode()

Deserialize response body into an object (JSON)

response.Unmarshal(&obj)

Response body as bytes (without unzipping gzip contents)

response.Raw()

Response body as a string (without unzipping gzip contents)

response.RawString()

Response length (without unzipping gzip contents)

response.RawLength()

Style

Please take a look at the style guidelines if you'd like to make a pull request.

Sponsors

Cedric Fung Scott Rayapoullé Eduard Urbach
Cedric Fung Scott Rayapoullé Eduard Urbach

Want to see your own name here?