http/bencode: add missing []Dict case

Fixes #238
This commit is contained in:
Leo Balduf
2016-10-01 08:06:42 -04:00
parent b96619d44a
commit 365a6caf43
2 changed files with 9 additions and 0 deletions

View File

@@ -89,6 +89,13 @@ func marshal(w io.Writer, data interface{}) (err error) {
case []interface{}:
err = marshalList(w, v)
case []Dict:
var interfaceSlice = make([]interface{}, len(v))
for i, d := range v {
interfaceSlice[i] = d
}
err = marshalList(w, interfaceSlice)
default:
return fmt.Errorf("attempted to marshal unsupported type:\n%T", v)
}