func send_msg(msg string, user string) {
url := "https://test.com/"
token := "Bearer " + get_token()
header := req.Header{
"Content-Type": "application/json",
"Authorization": token,
}
// this string param can not use variable user and msg.
// param := `{
// "email": "jjjj@gmail.com",
// "msg_type": "text",
// "content": { "text": "aaaaaaaaaaaaa" }
// }`
// this req.Param param error:missing type in composite literal
param := req.Param{
"email": user,
"msg_type": "text",
"content": { "text" : msg },
}
r,_ := req.Post(url, header, param)
resp := r.String()
log.Println(resp)
}
This req.Param param error:missing type in composite literal
This string param can not use variable user and msg.
How can I use variable param?