Skip to content

A chainable Go HTTP library for streamlined request and response management.一个可链式调用的 Go HTTP 库,用于简化请求和响应管理。

License

Notifications You must be signed in to change notification settings

chenmingyong0423/go-http-chain

Repository files navigation

go-http-chain

GitHub Repo stars GitHub issues GitHub License GitHub release (with filter) Go Report Card All Contributors

A chainable Go HTTP library for streamlined request and response management.


English | 中文简体

Install

go get github.com/chenmingyong0423/go-http-chain

Usage

// Create a new default client and set global Header parameters for the client
client := httpchain.NewDefault().SetHeader("X-Global-Param", "go-http-chain")
// Create a Request specifying a GET request; the client's Headers and Query parameters will be passed to this Request
// Retrieve the *http.Response
resp, err := client.Get("localhost:8080/test").
		SetHeader("name", "Mingyong Chen").
		SetQuery("name", "Mingyong Chen").
		Call(context.Background()).Result()

// Directly parse the response result into a specified struct
var result map[string]any
err = client.Get("localhost:8080/test").
		SetHeader("name", "Mingyong Chen").
		SetQuery("name", "Mingyong Chen").
		Call(context.Background()).DecodeRespBody(&result)

About

A chainable Go HTTP library for streamlined request and response management.一个可链式调用的 Go HTTP 库,用于简化请求和响应管理。

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages