I am using an HTTP client for Golang and the format of the POST request is as follows:
package main
import (
"log"
"github.com/monaco-io/request"
)
var name,pass string. //assume name and pass hold a value calculated earlier
func main() {
client := request.Client{
URL: "https://google.com",
Method: "POST",
Params: map[string]string{"random": "random"},
**Body: []byte(`{"username": "ABC", "password": "XYZ"}`)**,
}
resp, err := client.Do()
log.Println(resp.Code, string(resp.Data), err)
}
I want to replace "ABC" by my variable name and "XYZ" by my variable pass.** How can I replace a constant string value by a variable which holds some string value calculated in a function within my code.