I'm making a webserver in go and I need to give the response form the website to the client. this in the part of my code where i receive the response:
client := http.Client{}
resp, err := client.Do(request)
defer resp.Body.Close()
if err != nil {
log.Fatalln(err.Error())
}
The Do(request) returns a Response type and I need to send this response to the client (conn). I saw a method in conn type the writes data in the connection but it only accept bytes and i couldn't convert the response in bytes. I need to send the body, status and headers,can the conn.Write([]bytes) do that? How can I send this response to my client?