(ctx context.Context, req *http.Request)
| 523 | } |
| 524 | |
| 525 | func doHTTPClientRequest(ctx context.Context, req *http.Request) (*http.Response, error) { |
| 526 | dns, err := DNSConfig(ctx) |
| 527 | if err != nil { |
| 528 | return nil, err |
| 529 | } |
| 530 | client := http.Client{ |
| 531 | Transport: netconfhttp.NewTransport(http.DefaultTransport, dns), |
| 532 | } |
| 533 | resp, err := client.Do(req) |
| 534 | if err != nil { |
| 535 | return nil, err |
| 536 | } |
| 537 | if req.Method == http.MethodHead && resp.StatusCode == http.StatusMethodNotAllowed { |
| 538 | return resp, nil |
| 539 | } |
| 540 | if resp.StatusCode < 200 || resp.StatusCode >= 400 { |
| 541 | defer resp.Body.Close() |
| 542 | return nil, fmt.Errorf("invalid response status %s", resp.Status) |
| 543 | } |
| 544 | return resp, nil |
| 545 | } |
| 546 | |
| 547 | func parseOptionalChecksum(raw dagql.Optional[dagql.String]) (digest.Digest, error) { |
| 548 | if !raw.Valid || raw.Value == "" { |
no test coverage detected