Hi All, 
we copy response body from a call into *responseWriter* w.
my question is:
a) if err!=nil, it is possible that w is also not nil? Or no: if err!=nil 
then w is nil. 
b)  the following order is correct?
I would send response body (which is in *src* (resp.Body type 
io.ReadCloser)) as xml content type with OK status. 
And if error happens by io.Copy, then send a json body with status code 
599. 


*w.Header().Set("Content-Type", "application/xml")*

*_, err:=io.Copy(w,src) *

*if err!=nil{*
*re := &res{ Message: "Error happened",}*



*w.Header().Set("Content-Type", "application/json")w.WriteHeader(599) 
//sample status codeerr = json.NewEncoder(w).Encode(re)*
*}//if*

-- 
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/10d50e04-a328-4f54-a46d-947d4e2825d9n%40googlegroups.com.

Reply via email to