INNER CODE UNIT · Go

openInput

yannh/kubeconform · openapi2jsonschema-go/openapi2jsonschema.go:243

func openInput(path string) (io.ReadCloser, error) {
	if strings.HasPrefix(path, "http") {
		client := http.DefaultClient
		if os.Getenv("DISABLE_SSL_CERT_VALIDATION") != "" {
			client = &http.Client{Transport: &http.Transport{
				TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
			}}
		}
		resp, err := client.Get(path)
		if err != nil {
			return nil, err
		}
		if resp.StatusCode >= 400 {
			resp.Body.Close()
			return nil, fmt.Errorf("HTTP %d fetching %s", resp.StatusCode, path)
		}
		return resp.Body, nil
	}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…