@cryptotaxi247 / kubo / commits / 507192ef6

commands/http: Use request body as command input stream

Matt Bell committed Oct 28, 2014 at 17:52 UTC 507192ef6e14d50be5257747fe7062ce10c20733
1 file changed +6 -2
commands/http/parse.go
+6 -2
@@ -27,9 +27,13 @@ func Parse(r *http.Request) (cmds.Request, error) {
27 opts, args2 := parseOptions(r)
28 args = append(args, args2...)
29
30 - // TODO: input stream (from request body)
30 + // TODO: make a way to send opts/args in request body
31 + // (e.g. if form-data or form-urlencoded, then treat the same as querystring)
32 + // for now, to be simple, we just use the whole request body as the input stream
33 + // (r.Body will be nil if there is no request body, like in GET requests)
34 + in := r.Body
35
32 - return cmds.NewRequest(path, opts, args, nil), nil
36 + return cmds.NewRequest(path, opts, args, in), nil
37 }
38
39 func parseOptions(r *http.Request) (map[string]interface{}, []string) {