github.com/defang-io/defang/src@v0.0.0-20240505002154-bdf411911834/pkg/http/get.go (about)

     1  package http
     2  
     3  import (
     4  	"context"
     5  	"net/http"
     6  )
     7  
     8  func GetWithAuth(ctx context.Context, url, auth string) (*http.Response, error) {
     9  	hreq, err := http.NewRequestWithContext(ctx, "GET", url, nil)
    10  	if err != nil {
    11  		return nil, err
    12  	}
    13  	hreq.Header.Set("Authorization", auth)
    14  	return http.DefaultClient.Do(hreq)
    15  }