A concise HTTP request client for Go.
go get github.com/mushroomsir/request
- Easy to use.
- Support gzip、deflate decompress.
package main
import (
"github.com/mushroomsir/request"
)
func main() {
url := "https://github.com"
body := struct {
Any interface{} `json:"Any"`
}{
Any: "",
}
result := struct {
Any interface{} `json:"Any"`
}{}
request.Post(url).Body(&body).Result(&result).Do()
}
request.Get("url").Set("Content-Type", "application/json").Result(&result).Do()
or
header := http.Header{}
header.Set("Content-Type", "application/json")
request.Get("url").Header(header).Result(&result).Do()
All source code is licensed under the MIT License.