commands/http: Don't try to parse HTTP response into a Response, just read the output
Matt Bell committed
Oct 28, 2014 at 20:17 UTC
32a2959348caa54fbfc48d79f964f28dc403b067
1 file changed
+7
-8
commands/http/client.go
+7
-8
@@ -1,8 +1,8 @@
1
package http
2
3
import (
4
- "encoding/json"
5
- "fmt"
4
+ //"encoding/json"
5
+ //"fmt"
6
"net/http"
7
"strings"
8
@@ -28,11 +28,6 @@ func Send(req cmds.Request) (cmds.Response, error) {
28
url := "http://" + host + ApiPath
29
url += "/" + strings.Join(req.Path(), "/")
30
31
- // TODO: support other encodings once we have multicodec to decode response
32
- // (we shouldn't have to set this here)
33
- encoding := cmds.JSON
34
- req.SetOption(cmds.EncShort, encoding)
35
-
31
query := "?"
32
for k, v := range req.Options() {
33
query += "&" + k + "=" + v.(string)
@@ -46,7 +41,11 @@ func Send(req cmds.Request) (cmds.Response, error) {
41
return nil, err
42
}
43
44
+ // commented out: code to parse HTTP response and turn it into a cmds.Response
45
+ // for now, we are simply reading the data as a stream
46
res := cmds.NewResponse(req)
47
+ res.SetValue(httpRes.Body)
48
+ /*res := cmds.NewResponse(req)
49
50
contentType := httpRes.Header["Content-Type"][0]
51
contentType = strings.Split(contentType, ";")[0]
@@ -78,7 +77,7 @@ func Send(req cmds.Request) (cmds.Response, error) {
77
}
78
79
res.SetValue(v)
81
- }
80
+ }*/
81
82
return res, nil
83
}