Skip to content

Commit

Permalink
fix(data_source_github_rest_api): just read body and convert bytes in…
Browse files Browse the repository at this point in the history
…to string
  • Loading branch information
riezebosch committed Feb 16, 2024
1 parent 2d31318 commit 103cd5c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions github/data_source_github_rest_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package github
import (
"context"
"encoding/json"
"io"

"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
)
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 103cd5c

Please sign in to comment.