Fix http requests not working

fixes #294
This commit is contained in:
Josh Baker 2018-04-09 08:27:04 -07:00
parent 0659e0c705
commit 2e7003bc31
1 changed files with 20 additions and 19 deletions

View File

@ -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
}