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:
>
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,
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())
}
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
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
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
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
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(