Skip to content

Commit

Permalink
Fix search json unmarshal
Browse files Browse the repository at this point in the history
Resolves #2.
  • Loading branch information
hashworks committed May 12, 2022
1 parent ac07754 commit 296bad9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion srrdb/srrdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
"mime/multipart"
Expand All @@ -23,7 +24,7 @@ const srrdbURL = "https://www.srrdb.com"
// SearchResponse holds the results of a search.
type SearchResponse struct {
Results []SearchResult `json:"results"`
ResultCount string `json:"resultsCount"`
ResultCount int `json:"resultsCount"`
Warnings []string `json:"warnings"`
Query []string `json:"query"`
}
Expand Down Expand Up @@ -85,6 +86,9 @@ func Search(query string) (SearchResponse, error) {
return SearchResponse{}, err
}
var srrDBResponse SearchResponse

fmt.Println(string(bytes))

err = json.Unmarshal(bytes, &srrDBResponse)
return srrDBResponse, err
}
Expand Down

0 comments on commit 296bad9

Please sign in to comment.