fix: unmarshalling of audience as array (#53)

This commit is contained in:
Livio Amstutz 2020-09-10 08:35:37 +02:00 committed by GitHub
parent abd3b6f521
commit f645dd3543
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -241,10 +241,16 @@ func timeToJSON(t time.Time) int64 {
return t.Unix() return t.Unix()
} }
func audienceFromJSON(audience interface{}) []string { func audienceFromJSON(i interface{}) []string {
switch aud := audience.(type) { switch aud := i.(type) {
case []string: case []string:
return aud return aud
case []interface{}:
audience := make([]string, len(aud))
for i, a := range aud {
audience[i] = a.(string)
}
return audience
case string: case string:
return []string{aud} return []string{aud}
} }