diff --git a/github/data_source_github_rest_api.go b/github/data_source_github_rest_api.go index bc1b5f1a50..d72c1e2f50 100644 --- a/github/data_source_github_rest_api.go +++ b/github/data_source_github_rest_api.go @@ -3,6 +3,7 @@ package github import ( "context" "encoding/json" + "io" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) @@ -43,21 +44,22 @@ func dataSourceGithubRestApiRead(d *schema.ResourceData, meta interface{}) error client := meta.(*Owner).v3client ctx := context.Background() - var body map[string]interface{} - req, err := client.NewRequest("GET", u, nil) if err != nil { return err } - resp, _ := client.Do(ctx, req, &body) + resp, err := client.Do(ctx, req, nil) + if err != nil { + return err + } h, err := json.Marshal(resp.Header) if err != nil { return err } - b, err := json.Marshal(body) + b, err := io.ReadAll(resp.Body) if err != nil { return err }