From 2e7003bc31d7a349aeef679f1d4ffac2b9e5448d Mon Sep 17 00:00:00 2001 From: Josh Baker Date: Mon, 9 Apr 2018 08:27:04 -0700 Subject: [PATCH] Fix http requests not working fixes #294 --- controller/server/reader.go | 39 +++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/controller/server/reader.go b/controller/server/reader.go index a5c6585c..f110450e 100644 --- a/controller/server/reader.go +++ b/controller/server/reader.go @@ -223,28 +223,29 @@ moreData: if !complete { break } - if len(args) > 0 { - if kind != kindHTTP { - msg.Command = strings.ToLower(string(args[0])) - for i := 0; i < len(args); i++ { - args[i] = append([]byte{}, args[i]...) - msg.Values = append(msg.Values, resp.BytesValue(args[i])) - } - switch kind { - case redcon.Redis: - msg.ConnType = RESP - msg.OutputType = RESP - case redcon.Tile38: - msg.ConnType = Native - msg.OutputType = JSON - case redcon.Telnet: - msg.ConnType = RESP - msg.OutputType = RESP - } - } else if len(msg.Values) == 0 { + if kind == kindHTTP { + if len(msg.Values) == 0 { return nil, errInvalidHTTP } msgs = append(msgs, msg) + } else if len(args) > 0 { + msg.Command = strings.ToLower(string(args[0])) + for i := 0; i < len(args); i++ { + args[i] = append([]byte{}, args[i]...) + msg.Values = append(msg.Values, resp.BytesValue(args[i])) + } + switch kind { + case redcon.Redis: + msg.ConnType = RESP + msg.OutputType = RESP + case redcon.Tile38: + msg.ConnType = Native + msg.OutputType = JSON + case redcon.Telnet: + msg.ConnType = RESP + msg.OutputType = RESP + } + msgs = append(msgs, msg) } data = leftover }