(method string, url *url.URL, body string)
| 393 | } |
| 394 | |
| 395 | func newRequest(method string, url *url.URL, body string) *http.Request { |
| 396 | req, err := http.NewRequest(method, url.String(), createBody(body)) |
| 397 | if err != nil { |
| 398 | log.Fatalf("unable to create request: %v", err) |
| 399 | } |
| 400 | for _, h := range httpHeaders { |
| 401 | k, v := headerKeyValue(h) |
| 402 | if strings.EqualFold(k, "host") { |
| 403 | req.Host = v |
| 404 | continue |
| 405 | } |
| 406 | req.Header.Add(k, v) |
| 407 | } |
| 408 | return req |
| 409 | } |
| 410 | |
| 411 | func createBody(body string) io.Reader { |
| 412 | if strings.HasPrefix(body, "@") { |
no test coverage detected