Skip to content

Commit

Permalink
removed unneeded string type change
Browse files Browse the repository at this point in the history
  • Loading branch information
fantasticrabbit committed Nov 15, 2021
1 parent b9645ff commit f72c165
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions internal/requester.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func init() {
}

//Gets JSON data for any struct that implements Requester interface
func getJSON(apiPath string) string {
func getJSON(apiPath string) []byte {
req, _ := http.NewRequest(http.MethodGet, apiPath, nil)
req.Header.Add("Authorization", viper.GetString("token"))
req.Header.Add("Content-Type", "application/json")
Expand All @@ -40,12 +40,12 @@ func getJSON(apiPath string) string {
}
defer resp.Body.Close()
resp_body, _ := ioutil.ReadAll(resp.Body)
return string(resp_body)
return resp_body
}

func FormatJSON(str string) string {
func FormatJSON(jsonresp []byte) string {
var formattedJSON bytes.Buffer
if err := json.Indent(&formattedJSON, []byte(str), "", " "); err != nil {
if err := json.Indent(&formattedJSON, jsonresp, "", " "); err != nil {
log.Fatalln(err)
}
return formattedJSON.String()
Expand Down

0 comments on commit f72c165

Please sign in to comment.