Skip to content
This repository has been archived by the owner on Jun 10, 2024. It is now read-only.

Commit

Permalink
Included additional log messages.
Browse files Browse the repository at this point in the history
Signed-off-by: naveensrinivasan <[email protected]>
  • Loading branch information
naveensrinivasan committed Jun 7, 2023
1 parent 1d61599 commit f113687
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package main

import (
"bytes"
"context"
"encoding/json"
"fmt"
Expand Down Expand Up @@ -268,6 +269,16 @@ func GetDependencyDiff(owner, repo, token, base, head string) ([]DependencyDiff,
return data, fmt.Errorf("failed to get dependency diff: %w", err)
}

// print the repnose body for debugging
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return data, fmt.Errorf("failed to read response body: %w", err)
}
fmt.Println(string(body))
// also decode the response body
// reset the body
resp.Body = ioutil.NopCloser(bytes.NewBuffer(body)) //nolint:staticcheck

err = json.NewDecoder(resp.Body).Decode(&data)
if err != nil {
return data, fmt.Errorf("failed to decode dependency diff: %w", err)
Expand Down

0 comments on commit f113687

Please sign in to comment.