I need to receive an http request, modify the XML body slightly, and resend the request to another server. I'm receiving the original request (inreq), am able to
dump the body and verify the contents, and then create a new request, like this:
newreq := http.NewRequest(inreq.Method, dest, inreq.Body)
newreq.Close = true
newreq.Body = inreq.Body
resp, err1 := client.Do(newreq)
however I get an error: http: Request.ContentLength=596 with Body length 0
Is there a different way I should be copying the body to newreq? Related, I also want to modify the body, but it's type is called an "io.ReaderCloser". I'm not sure how I can convert this to a string, modify, and get it back to being a ReaderCloser.
Suggestions appreciated...
Ken