Re: [go-nuts] Did you try to handle http gzip requests?

2018-04-13 Thread Yaroslav Molochko
All() on the Body > first (putting it into a bytes.Buffer) then attempt to create a gzip > reader from that. That will give you a chance to examine how much and > what data exactly you were reading from the client. > > On Thu, Apr 12, 2018 at 2:05 PM, Yaroslav Molochko > wrote: >

Re: [go-nuts] Did you try to handle http gzip requests?

2018-04-12 Thread Yaroslav Molochko
will be propagated up to your handler and will cause the error > checking to fail. > > your best source of action, in my opinion, is to treat io.EOF from > gzip.NewReader() as a real error. > > On Thu, Apr 12, 2018 at 1:09 PM, Yaroslav Molochko > wrote: > > Hi guys,

[go-nuts] Did you try to handle http gzip requests?

2018-04-12 Thread Yaroslav Molochko
Hi guys, I have following code: func handler(w http.ResponseWriter, r *http.Request) { var reader io.Reader switch r.Header.Get("Content-Encoding") { case "gzip": gz, err := gzip.NewReader(r.Body) if err != nil && err.Error() != "EOF" { fmt.Fprintf(w, "error with gzip reader: %s", err.Error()) }

[go-nuts] Re: Variable JSON format parsing, any best practice?

2017-09-29 Thread Yaroslav Molochko
That is exactly what I was looking for! Thank you very much! -- 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. For more op

Re: [go-nuts] Weird stack overflow error for struct with interface in it (a golang bug? )

2017-09-28 Thread Yaroslav Molochko
thanks! On Friday, September 29, 2017 at 2:36:06 AM UTC+3, Steven Hartland wrote: > > Which then calls the function your in, which then creates another > variable BOOM! > > On 29/09/2017 00:15, Yaroslav Molochko wrote: > > But I'm using other variable not t

[go-nuts] Variable JSON format parsing, any best practice?

2017-09-28 Thread Yaroslav Molochko
I have following json messages: {"status":"success","data":["val1","val2","val3"]} {"status":"success","data":{"resultType":"vector","result":[{"metric":{"host_name":"hss4"},"value":[1504157313.787,"24"]},{"metric":{"host_name":"hss508"},"value":[1504157313.787,"32"]}]}} where *data* can have sev

Re: [go-nuts] Weird stack overflow error for struct with interface in it (a golang bug? )

2017-09-28 Thread Yaroslav Molochko
nmarshalling, hence the stack overflow error. > > On 28/09/2017 23:59, Yaroslav Molochko wrote: > > Here is the code which runs: > > https://play.golang.org/p/ds3KZspFvE > > If you press play, it will work fine and gives an expected output, > > as soon as you uncommen

[go-nuts] Weird stack overflow error for struct with interface in it (a golang bug? )

2017-09-28 Thread Yaroslav Molochko
Here is the code which runs: https://play.golang.org/p/ds3KZspFvE If you press play, it will work fine and gives an expected output, as soon as you uncomment this part: /* func (u *Result) UnmarshalJSON(b []byte) error { var ts Result err := json.Unmarshal(b, &ts) if err != nil { fmt.Println(