mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-02 03:28:25 +08:00
commands/http: client: Fixed decoding values in channel output
This commit is contained in:
@ -7,6 +7,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
cmds "github.com/jbenet/go-ipfs/commands"
|
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{})
|
outChan := make(chan interface{})
|
||||||
go func() {
|
go func() {
|
||||||
dec := json.NewDecoder(httpRes.Body)
|
dec := json.NewDecoder(httpRes.Body)
|
||||||
v := req.Command().Type
|
outputType := reflect.ValueOf(req.Command().Type).Type()
|
||||||
|
v := reflect.New(outputType).Interface()
|
||||||
|
|
||||||
for {
|
for {
|
||||||
err := dec.Decode(&v)
|
err := dec.Decode(&v)
|
||||||
|
Reference in New Issue
Block a user