diff options
Diffstat (limited to 'pkg/api/handlers/decoder.go')
-rw-r--r-- | pkg/api/handlers/decoder.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/pkg/api/handlers/decoder.go b/pkg/api/handlers/decoder.go index 5e8f12960..fbe03d97b 100644 --- a/pkg/api/handlers/decoder.go +++ b/pkg/api/handlers/decoder.go @@ -21,6 +21,7 @@ func NewAPIDecoder() *schema.Decoder { d.RegisterConverter(map[string][]string{}, convertURLValuesString) d.RegisterConverter(time.Time{}, convertTimeString) d.RegisterConverter(define.ContainerStatus(0), convertContainerStatusString) + d.RegisterConverter(map[string]string{}, convertStringMap) var Signal syscall.Signal d.RegisterConverter(Signal, convertSignal) @@ -48,6 +49,15 @@ func convertURLValuesString(query string) reflect.Value { return reflect.ValueOf(f) } +func convertStringMap(query string) reflect.Value { + res := make(map[string]string) + err := json.Unmarshal([]byte(query), &res) + if err != nil { + logrus.Infof("convertStringMap: Failed to Unmarshal %s: %s", query, err.Error()) + } + return reflect.ValueOf(res) +} + func convertContainerStatusString(query string) reflect.Value { result, err := define.StringToContainerStatus(query) if err != nil { |