mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-27 21:37:57 +08:00
commands: Got rid of Response#Stream() in favor of setting value to a io.Reader
This commit is contained in:
parent
b65a5bacbe
commit
dd84a3eb44
@ -4,7 +4,6 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
"io"
|
||||
|
||||
u "github.com/jbenet/go-ipfs/util"
|
||||
)
|
||||
@ -48,9 +47,8 @@ func (c *Command) Register(id string, sub *Command) error {
|
||||
}
|
||||
|
||||
// Call invokes the command for the given Request
|
||||
// Streaming output is written to `out`
|
||||
func (c *Command) Call(req Request, out io.Writer) Response {
|
||||
res := NewResponse(req, out)
|
||||
func (c *Command) Call(req Request) Response {
|
||||
res := NewResponse(req)
|
||||
|
||||
cmds, err := c.Resolve(req.Path())
|
||||
if err != nil {
|
||||
|
||||
@ -60,9 +60,6 @@ type Response interface {
|
||||
SetValue(interface{})
|
||||
Value() interface{}
|
||||
|
||||
// Returns the output stream Writer
|
||||
Stream() io.Writer
|
||||
|
||||
// Marshal marshals out the response into a buffer. It uses the EncodingType
|
||||
// on the Request to chose a Marshaller (Codec).
|
||||
Marshal() ([]byte, error)
|
||||
@ -125,6 +122,6 @@ func (r *response) Marshal() ([]byte, error) {
|
||||
}
|
||||
|
||||
// NewResponse returns a response to match given Request
|
||||
func NewResponse(req Request, out io.Writer) Response {
|
||||
return &response{req: req, out: out}
|
||||
func NewResponse(req Request) Response {
|
||||
return &response{req: req}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user