SetBody set body data, support string and []byte, if it is not string, it will be json marshal.
(body interface{})
| 88 | |
| 89 | // SetBody set body data, support string and []byte, if it is not string, it will be json marshal. |
| 90 | func (req *Request) SetBody(body interface{}) *Request { |
| 91 | switch v := body.(type) { |
| 92 | case string: |
| 93 | req.body = v |
| 94 | case []byte: |
| 95 | req.body = string(v) |
| 96 | default: |
| 97 | req.bodyJSON = body |
| 98 | } |
| 99 | return req |
| 100 | } |
| 101 | |
| 102 | // SetTimeout set timeout |
| 103 | func (req *Request) SetTimeout(t time.Duration) *Request { |
no outgoing calls