1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-07-01 19:24:14 +08:00

commands/http: client: Fixed decoding values in channel output

This commit is contained in:
Matt Bell
2015-01-05 14:19:13 -08:00
parent 981f793df9
commit ecc2248aa0

View File

@ -7,6 +7,7 @@ import (
"io"
"net/http"
"net/url"
"reflect"
"strings"
cmds "github.com/jbenet/go-ipfs/commands"
@ -149,7 +150,8 @@ func getResponse(httpRes *http.Response, req cmds.Request) (cmds.Response, error
outChan := make(chan interface{})
go func() {
dec := json.NewDecoder(httpRes.Body)
v := req.Command().Type
outputType := reflect.ValueOf(req.Command().Type).Type()
v := reflect.New(outputType).Interface()
for {
err := dec.Decode(&v)