Skip to content

Commit 45ef892

Browse files
mappumjbenet
authored andcommitted
commands: Renamed Response#Value to Response#Output
1 parent 93d0cc0 commit 45ef892

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

http/client.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func Send(req cmds.Request) (cmds.Response, error) {
8080
contentType = strings.Split(contentType, ";")[0]
8181

8282
if contentType == "application/octet-stream" {
83-
res.SetValue(httpRes.Body)
83+
res.SetOutput(httpRes.Body)
8484
return res, nil
8585
}
8686

@@ -120,7 +120,7 @@ func Send(req cmds.Request) (cmds.Response, error) {
120120
return nil, err
121121
}
122122

123-
res.SetValue(v)
123+
res.SetOutput(v)
124124
}
125125

126126
if len(userEncoding) > 0 {

http/handler.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func (i Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
3838
res := i.Root.Call(req)
3939

4040
// set the Content-Type based on res output
41-
if _, ok := res.Value().(io.Reader); ok {
41+
if _, ok := res.Output().(io.Reader); ok {
4242
// TODO: set based on actual Content-Type of file
4343
w.Header().Set("Content-Type", "application/octet-stream")
4444
} else {

response.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ var marshallers = map[EncodingType]Marshaller{
4949
if res.Error() != nil {
5050
return json.Marshal(res.Error())
5151
}
52-
return json.Marshal(res.Value())
52+
return json.Marshal(res.Output())
5353
},
5454
XML: func(res Response) ([]byte, error) {
5555
if res.Error() != nil {
5656
return xml.Marshal(res.Error())
5757
}
58-
return xml.Marshal(res.Value())
58+
return xml.Marshal(res.Output())
5959
},
6060
Text: func(res Response) ([]byte, error) {
6161
format := res.Request().Command().Format
@@ -83,8 +83,8 @@ type Response interface {
8383
Error() *Error
8484

8585
// Sets/Returns the response value
86-
SetValue(interface{})
87-
Value() interface{}
86+
SetOutput(interface{})
87+
Output() interface{}
8888

8989
// Marshal marshals out the response into a buffer. It uses the EncodingType
9090
// on the Request to chose a Marshaller (Codec).
@@ -102,11 +102,11 @@ func (r *response) Request() Request {
102102
return r.req
103103
}
104104

105-
func (r *response) Value() interface{} {
105+
func (r *response) Output() interface{} {
106106
return r.value
107107
}
108108

109-
func (r *response) SetValue(v interface{}) {
109+
func (r *response) SetOutput(v interface{}) {
110110
r.value = v
111111
}
112112

response_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ func TestMarshalling(t *testing.T) {
1414
req := NewEmptyRequest()
1515

1616
res := NewResponse(req)
17-
res.SetValue(TestOutput{"beep", "boop", 1337})
17+
res.SetOutput(TestOutput{"beep", "boop", 1337})
1818

1919
// get command global options so we can set the encoding option
2020
cmd := Command{}

0 commit comments

Comments
 (0)