Skip to content

net/http: json decoding fails from httptest in tip, works in 1.4 and over bytes.Buffer #11893

Closed
@ThomasHabets

Description

@ThomasHabets

Code

http://play.golang.org/p/DPZUao3rPB

Should output (and does under Go 1.4)

Decoding with bytes.Buffer: <nil>, {"bar"}
Decoding with http stream: <nil>, {"bar"}
Decoding with http stream bouncing on bytes.Buffer: <nil>, {"bar"}
Yes, "{ \"foo\": \"bar\" }" really is "{ \"foo\": \"bar\" }"

With tip(129cfa2) outputs

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

Expected

not EOF. Doesn't matter which io.Reader it's read from, it should either be seen as valid or it shouldn't.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions