Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Vladimir Barsukov
zGo
Commits
8b5f72c0
Commit
8b5f72c0
authored
Jun 27, 2024
by
Vladimir Barsukov
Browse files
GetJson
parent
5528fd07
Changes
1
Hide whitespace changes
Inline
Side-by-side
zhttp/zhttp.go
View file @
8b5f72c0
...
@@ -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
)
GetJ
SON
(
target
any
,
url
string
)
error
{
func
(
c
*
ZClient
)
GetJ
son
(
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
)
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment