Commit 8b5f72c0 authored by Vladimir Barsukov's avatar Vladimir Barsukov
Browse files

GetJson

parent 5528fd07
...@@ -57,7 +57,7 @@ func (c *ZClient) GetEmpty(url string) error { ...@@ -57,7 +57,7 @@ func (c *ZClient) GetEmpty(url string) error {
return fmt.Errorf("status code: %v", resp.StatusCode) return fmt.Errorf("status code: %v", resp.StatusCode)
} }
func (c *ZClient) GetJSON(target any, url string) error { func (c *ZClient) GetJson(target any, url string) error {
var err error var err error
var resp *http.Response var resp *http.Response
...@@ -68,3 +68,7 @@ func (c *ZClient) GetJSON(target any, url string) error { ...@@ -68,3 +68,7 @@ func (c *ZClient) GetJSON(target any, url string) error {
return json.NewDecoder(resp.Body).Decode(&target) return json.NewDecoder(resp.Body).Decode(&target)
} }
func GetJson(target any, url string) error {
return Default().GetJson(target, url)
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment