INNER CODE UNIT · Go
fetchBytes
platform-engineering-labs/formae · cmd/bundle-examples/main.go:278
func fetchBytes(url string) ([]byte, error) {
resp, err := httpClient.Get(url)
if err != nil {
return nil, err
}
defer func() { _ = resp.Body.Close() }()
if resp.StatusCode != 200 {
return nil, fmt.Errorf("GET %s: %s", url, resp.Status)
}
return io.ReadAll(resp.Body)
}
func probeGET(url string) error {
resp, err := httpClient.Get(url)
if err != nil {
return err
}
_, _ = io.Copy(io.Discard, resp.Body)