Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
Example ¶
package main
import (
"fmt"
"time"
"github.com/omalloc/contrib/kratos/resty"
)
type TestAnythingBody struct {
Args struct {
Example string `json:"example,omitempty"`
} `json:"args"`
Headers map[string]string `json:"headers"`
}
func main() {
client := resty.New().SetTimeout(time.Second * 10)
var body TestAnythingBody
resp, err := client.NewRequest().SetResult(&body).Get("https://httpbin.org/anything?example=new")
if err != nil {
panic(err)
}
fmt.Printf("%d-%s", resp.StatusCode(), body.Args.Example)
}
Output: 200-new
Types ¶
type ClientOption ¶
type ClientOption struct {
// contains filtered or unexported fields
}
ClientOption 自定义属性
type Option ¶
type Option func(*ClientOption)
func WithPropagators ¶
func WithPropagators(propagators propagation.TextMapPropagator) Option
func WithTimeout ¶
func WithTracer ¶
func WithTransport ¶
Click to show internal directories.
Click to hide internal directories.