json decoding broken over httptest in tip, works in 1.4.

170 views
Skip to first unread message

tho...@habets.se

unread,
Jul 27, 2015, 5:05:02 PM7/27/15
to golang-dev
Or alternatively, I just missed something stupid.

Summary:
Decoding from a bytes.Buffer works.
Decoding from a httptest errors with "EOF"

Example code:

Output with 1.4:
$ go run lalatest.go
Decoding with bytes.Buffer: <nil>
Decoding with http stream: <nil>
Yes, "{ \"foo\": \"bar\" }" really is "{ \"foo\": \"bar\" }"

Output with tip (129cfa2745a3db0fd55fd13fd46da0e75b9ce7dc):
$ go run lalatest.go 
Decoding with bytes.Buffer: <nil>
Decoding with http stream: EOF
Yes, "{ \"foo\": \"bar\" }" really is "{ \"foo\": \"bar\" }"

I don't expect any differences in decoding the same data (it really should be the same data) from a bytes.Buffer and over HTTP.

Some more verbose example:

Rob Pike

unread,
Jul 27, 2015, 8:33:47 PM7/27/15
to tho...@habets.se, golang-dev
I believe this was broken by https://go-review.googlesource.com/#/c/9073/
> --
> You received this message because you are subscribed to the Google Groups
> "golang-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-dev+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Peter Waldschmidt

unread,
Jul 27, 2015, 9:36:39 PM7/27/15
to golang-dev, tho...@habets.se, r...@golang.org
I've posted a CL that fixes this bug. See https://go-review.googlesource.com/12726 
Reply all
Reply to author
Forward
0 new messages