go-httpclient icon indicating copy to clipboard operation
go-httpclient copied to clipboard

feat: add response.ToJson

Open qiankunli opened this issue 2 years ago • 0 comments

usage example

c := NewHttpClient()
res, err := c.Get("http://httpbin.org/user-agent")

if err != nil {
  t.Error(err)
}
type Result struct {
   UserAgent string `json:"user-agent"`
}
result := &Result{}
err = res.ToJson(result)
if err != nil {
  t.Error(err)
}

qiankunli avatar Jul 03 '23 07:07 qiankunli