marshaling json data manually

This commit is contained in:
Baipyrus 2024-04-12 10:49:49 +02:00
parent 43e2e18ded
commit 82270c6d57

10
main.go
View File

@ -117,6 +117,16 @@ func LoadMatrixData() (string, int, int) {
} }
func SendRequest(client *resty.Client, url string, ins []interface{}) { func SendRequest(client *resty.Client, url string, ins []interface{}) {
// Manually marshal instructions
marshal, err := json.Marshal(ins)
if err != nil {
log.Fatal(err)
return
}
// Debug log json data
log.Printf("Request: %s\n", string(marshal))
// Build and send request // Build and send request
resp, err := client.R(). resp, err := client.R().
SetHeader("Content-Type", "application/json"). SetHeader("Content-Type", "application/json").