MCPcopy Index your code
hub / github.com/dagger/dagger / doHTTPClientRequest

Function doHTTPClientRequest

core/http.go:525–545  ·  view source on GitHub ↗
(ctx context.Context, req *http.Request)

Source from the content-addressed store, hash-verified

523}
524
525func 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
547func parseOptionalChecksum(raw dagql.Optional[dagql.String]) (digest.Digest, error) {
548 if !raw.Valid || raw.Value == "" {

Callers 1

FetchHTTPFileFunction · 0.85

Calls 4

DoMethod · 0.95
NewTransportFunction · 0.92
DNSConfigFunction · 0.70
CloseMethod · 0.65

Tested by

no test coverage detected