commands/http: client: Fixed decoding values in channel output
Matt Bell committed
Jan 5, 2015 at 14:19 UTC
ecc2248aa06516856506dba64cbc3a61e41938cc
1 file changed
+3
-1
commands/http/client.go
+3
-1
@@ -7,6 +7,7 @@ import (
7
"io"
8
"net/http"
9
"net/url"
10
+ "reflect"
11
"strings"
12
13
cmds "github.com/jbenet/go-ipfs/commands"
@@ -149,7 +150,8 @@ func getResponse(httpRes *http.Response, req cmds.Request) (cmds.Response, error
150
outChan := make(chan interface{})
151
go func() {
152
dec := json.NewDecoder(httpRes.Body)
152
- v := req.Command().Type
153
+ outputType := reflect.ValueOf(req.Command().Type).Type()
154
+ v := reflect.New(outputType).Interface()
155
156
for {
157
err := dec.Decode(&v)