Body adds request raw body. it supports string and []byte.
(data any)
| 229 | // Body adds request raw body. |
| 230 | // it supports string and []byte. |
| 231 | func (r *Request) Body(data any) *Request { |
| 232 | switch t := data.(type) { |
| 233 | case string: |
| 234 | bf := bytes.NewBufferString(t) |
| 235 | r.req.Body = io.NopCloser(bf) |
| 236 | r.req.ContentLength = int64(len(t)) |
| 237 | case []byte: |
| 238 | bf := bytes.NewBuffer(t) |
| 239 | r.req.Body = io.NopCloser(bf) |
| 240 | r.req.ContentLength = int64(len(t)) |
| 241 | } |
| 242 | return r |
| 243 | } |
| 244 | |
| 245 | func (r *Request) getResponse() (*http.Response, error) { |
| 246 | if r.resp.StatusCode != 0 { |
no outgoing calls
no test coverage detected