Skip to content

Latest commit

 

History

History
18 lines (16 loc) · 503 Bytes

readme.md

File metadata and controls

18 lines (16 loc) · 503 Bytes

Simple http client for go, easy to use

Example

result := Credential{}
client := httpclient.NewClient(
  	httpclient.WithSender(gosender.New(gosender.WithTimeout(time.Second * 5))),
)
statusCode, err := client.Post(context.Background(), "http://localhost:8080/login",
   	httpclient.WithBodyProvider(body.NewJson(Credential{
   		Username: "admin",
   		Password: "admin",
   	})),
   	httpclient.WithHookFn(hook.UnmarshalResponse(&result)),
   	httpclient.WithHookFn(hook.Log()),
)