golang-nuts@googlegroups.com

2021-10-26 Thread RS
err = json.NewDecoder(res.Body).Decode(&gr) if err != nil { log.Println("ERROR:", err) return } Using json.newdecoder to decode the coming response body from client? Here is also the issue of " loading the entire response in memory and parsing it" is a matter? As I am not using a buffer to copy?

[go-nuts] unmarshal xml to a struct edmx:Edmx

2021-10-08 Thread RS
I want to unmarshal an xml data to a data structure. Problem is the following This xml comes from a Odata Server and has fields "edmx:Edmx". How should the fields of struct be named? I observe that the fields name of struct representing xml should be the same name as xml field name. Now how on

[go-nuts] xml to json, parsing xml

2021-10-07 Thread RS
What is the best approach to convert xml to json? However I need above all to parse a very complex xml to see if related properties are existing. I thought maybe converting it to Json maybe make it easier. -- You received this message because you are subscribed to the Google Groups "golang-

[go-nuts] copy resp.Body to *bytes.Buffer

2021-10-07 Thread RS
How can I copy resp.Body to a *bytes.Buffer? I am new to go. resp.Body is the response which I get from client.Do, and is of type *http.Response -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving

[go-nuts] sending server response to a client by w responseWriter

2021-10-07 Thread RS
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 dir

Re: [go-nuts] io.Copy error handling

2021-10-06 Thread RS
m the buffer can't fail, and errors from writing to the > ResponseWriter you can ignore. Or, if you don't want to buffer the result, > live with the fact that the client might get a partial response. > > > On Wed, Oct 6, 2021 at 3:04 PM RS wrote: > >> Hi All,

Re: [go-nuts] io.Copy error handling

2021-10-06 Thread RS
riting to the > ResponseWriter you can ignore. Or, if you don't want to buffer the result, > live with the fact that the client might get a partial response. > > > On Wed, Oct 6, 2021 at 3:04 PM RS wrote: > >> Hi All, >> we copy response body from a call into *

[go-nuts] io.Copy error handling

2021-10-06 Thread RS
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 co

[go-nuts] go swagger client code usage

2020-05-06 Thread RS
Hi, via *swagger generate client -f file.json* I have created client side golang codes. The question is how can I use those generated codes for each REST API in my golang project as consumer. As a golang/swagger-newbie an example would be appreciated. Thanks Larisa -- You received this me