Best practice in following scenario:

In my func for an endpoint (handler) with  func hello(w 
http.ResponseWriter, req *http.Request) 
I call another server get the resp.Body (Body io.ReadCloser) and want to 
write this Body  in w (ResponseWriter ).
What is best practice?
I have already copied directly Body to w via io.Copy. 
I want but make sure that the whole body is sent to client. 
With io.Copy I am not sure if this is guaranteed. 
And I would like to set status to 500 in case io.Copy returns err. 

Could you please help me on this?


-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/5f0e7131-2625-452d-9861-51f5e42345d8n%40googlegroups.com.

Reply via email to