diff options
author | Chris <ccbrown112@gmail.com> | 2017-09-11 10:09:24 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-11 10:09:24 -0500 |
commit | 674a606bd00b276d0a05b3b29a3d5f5e5e7f8206 (patch) | |
tree | 20b90abc4020c268edf407df80a6a3c9a70507b3 /model/command_response.go | |
parent | 402491b7e52c4d836c1274976cdb387852cfd17b (diff) | |
download | chat-674a606bd00b276d0a05b3b29a3d5f5e5e7f8206.tar.gz chat-674a606bd00b276d0a05b3b29a3d5f5e5e7f8206.tar.bz2 chat-674a606bd00b276d0a05b3b29a3d5f5e5e7f8206.zip |
more robust command response content-type checking (#7412)
Diffstat (limited to 'model/command_response.go')
-rw-r--r-- | model/command_response.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/model/command_response.go b/model/command_response.go index 0b80b297b..d17bd00e3 100644 --- a/model/command_response.go +++ b/model/command_response.go @@ -7,6 +7,7 @@ import ( "encoding/json" "io" "io/ioutil" + "strings" ) const ( @@ -33,7 +34,7 @@ func (o *CommandResponse) ToJson() string { } func CommandResponseFromHTTPBody(contentType string, body io.Reader) *CommandResponse { - if contentType == "application/json" { + if strings.TrimSpace(strings.Split(contentType, ";")[0]) == "application/json" { return CommandResponseFromJson(body) } if b, err := ioutil.ReadAll(body); err == nil { |