MCPcopy Create free account
hub / github.com/linuxkit/linuxkit / validateHTTPURL

Function validateHTTPURL

src/cmd/linuxkit/run_equinixmetal.go:318–327  ·  view source on GitHub ↗

validateHTTPURL does a sanity check that a URL returns a 200 or 300 response

(url string)

Source from the content-addressed store, hash-verified

316
317// validateHTTPURL does a sanity check that a URL returns a 200 or 300 response
318func validateHTTPURL(url string) error {
319 resp, err := http.Head(url)
320 if err != nil {
321 return err
322 }
323 if resp.StatusCode >= 400 {
324 return fmt.Errorf("got a non 200- or 300- HTTP response code: %s", resp.Status)
325 }
326 return nil
327}
328
329func equinixmetalSOS(user, host string) error {
330 log.Debugf("console: ssh %s@%s", user, host)

Callers 1

runEquinixMetalCmdFunction · 0.85

Calls 1

HeadMethod · 0.80

Tested by

no test coverage detected