Skip to content

mushroomsir/request

Repository files navigation

request

Build Status Coverage Status License GoDoc

A concise HTTP request client for Go.

Installation

go get github.com/mushroomsir/request

Feature

  • Easy to use.
  • Support gzip、deflate decompress.

Usage

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()
}

Header

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()

Licenses

All source code is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published