mirror of
https://gitlab1.ptb.de/waltem01/Matrix
synced 2024-12-26 03:51: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
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
@ -130,6 +131,17 @@ func SendRequest(client *resty.Client, url string, ins []interface{}) {
|
||||
|
||||
// Print response 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() {
|
||||
|
Loading…
Reference in New Issue
Block a user