in pkg/genlib/fields/load.go [233:258]
func getFromURL(ctx context.Context, srcURL string) (io.ReadCloser, error) {
req, err := http.NewRequestWithContext(ctx, "GET", srcURL, nil)
if err != nil {
return nil, err
}
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
if resp.Body != nil {
_ = resp.Body.Close()
}
return nil, err
}
if resp.StatusCode != http.StatusOK {
if resp.Body != nil {
_ = resp.Body.Close()
}
return nil, ErrNotFound
}
return resp.Body, nil
}