Added icon and image properties to object unmarshalling

This commit is contained in:
Marius Orcsik 2018-12-23 17:09:48 +01:00
parent a955ef13ec
commit d1e2ae9598
No known key found for this signature in database
GPG key ID: 8218F7122969D484
2 changed files with 8 additions and 0 deletions

View file

@ -541,6 +541,8 @@ func (o *Object) UnmarshalJSON(data []byte) error {
o.InReplyTo = getAPItem(data, "inReplyTo")
o.Published = getAPTime(data, "published")
o.StartTime = getAPTime(data, "startTime")
o.Icon = getAPItem(data, "icon")
o.Image = getAPItem(data, "image")
o.Updated = getAPTime(data, "updated")
to := getAPItems(data, "to")
if to != nil {

View file

@ -330,6 +330,12 @@ func validateEmptyObject(o Object, t *testing.T) {
if o.URL != nil {
t.Errorf("Unmarshalled object %T should have empty URL, received %v", o, o.URL)
}
if o.Icon != nil {
t.Errorf("Unmarshalled object %T should have empty Icon, received %v", o, o.Icon)
}
if o.Image != nil {
t.Errorf("Unmarshalled object %T should have empty Image, received %v", o, o.Image)
}
if !o.Published.IsZero() {
t.Errorf("Unmarshalled object %T should have empty Published, received %q", o, o.Published)
}