package v3 import ( "fmt" "io" "net/http" ) func requestJSON(url string, client *http.Client) (string, error) { // Send GET request with the given URL and special headers req, err := http.NewRequest("GET", url, nil) if err != nil { fmt.Printf("Error occurred while creating the request: %s\n", err.Error()) return "", err } // add header -H 'accept: application/ld+json' req.Header.Add("accept", "application/ld+json") response, err := client.Do(req) if err != nil { fmt.Printf("Error occurred while making the request: %s\n", err.Error()) return "", err } defer func(Body io.ReadCloser) { err := Body.Close() if err != nil { return } }(response.Body) // Read the response body body, err := io.ReadAll(response.Body) if err != nil { fmt.Printf("Error occurred while reading the response: %s\n", err.Error()) return "", err } return string(body), err }