@cryptotaxi247 / kubo / commits / df6c70042

commands/http: Renamed variable for clarity

Matt Bell committed Nov 4, 2014 at 00:18 UTC df6c7004262227ed084d7503dafc88f9f6ac122b
1 file changed +6 -6
commands/http/client.go
+6 -6
@@ -41,7 +41,7 @@ func (c *client) Send(req cmds.Request) (cmds.Response, error) {
41 req.SetOption(cmds.EncLong, cmds.JSON)
42 }
43
44 - query, in, err := getQuery(req)
44 + query, inputStream, err := getQuery(req)
45 if err != nil {
46 return nil, err
47 }
@@ -49,7 +49,7 @@ func (c *client) Send(req cmds.Request) (cmds.Response, error) {
49 path := strings.Join(req.Path(), "/")
50 url := fmt.Sprintf(ApiUrlFormat, c.serverAddress, ApiPath, path, query)
51
52 - httpRes, err := http.Post(url, "application/octet-stream", in)
52 + httpRes, err := http.Post(url, "application/octet-stream", inputStream)
53 if err != nil {
54 return nil, err
55 }
@@ -69,7 +69,7 @@ func (c *client) Send(req cmds.Request) (cmds.Response, error) {
69
70 func getQuery(req cmds.Request) (string, io.Reader, error) {
71 // TODO: handle multiple files with multipart
72 - var in io.Reader
72 + var inputStream io.Reader
73
74 query := url.Values{}
75 for k, v := range req.Options() {
@@ -90,14 +90,14 @@ func getQuery(req cmds.Request) (string, io.Reader, error) {
90
91 } else {
92 // TODO: multipart
93 - if in != nil {
93 + if inputStream != nil {
94 return "", nil, fmt.Errorf("Currently, only one file stream is possible per request")
95 }
96 - in = arg.(io.Reader)
96 + inputStream = arg.(io.Reader)
97 }
98 }
99
100 - return query.Encode(), in, nil
100 + return query.Encode(), inputStream, nil
101 }
102
103 // getResponse decodes a http.Response to create a cmds.Response