I have this code:
type myStruct struct {
ID string `json:"id"`
Nombre string `json:"nombre"`
Date time.Time `json:"date"`
}
func sendJson(data myStruct,url string) error {
jsonString, _:= json.Marshal(data)
pedir, _ := http.NewRequest("PATCH",url, bytes.NewBuffer(jsonString))
pedir.Header.Add("Content-Length", ?????)
.....
}
But, I don´t know how to get the length; I´ve been searching on internet with no solution found, and in case you wonder why do I need to add Content-Length if mostly it is not required, I´m using some apis from google that says explicity I need to add this header