mirror of
https://gitlab1.ptb.de/waltem01/Matrix
synced 2024-12-26 12:01:45 +00:00
unmarshal response data
This commit is contained in:
parent
57ac3eed34
commit
454ef40765
12
main.go
12
main.go
@ -1,6 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
@ -130,6 +131,17 @@ func SendRequest(client *resty.Client, url string, ins []interface{}) {
|
|||||||
|
|
||||||
// Print response status
|
// Print response status
|
||||||
log.Printf("Response Status: %s\n", resp.Status())
|
log.Printf("Response Status: %s\n", resp.Status())
|
||||||
|
|
||||||
|
// Unmarshal response
|
||||||
|
var data Response
|
||||||
|
err = json.Unmarshal(resp.Body(), &data)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Print response
|
||||||
|
log.Printf("Success: %t\n", data.success)
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
Loading…
Reference in New Issue
Block a user