Marshal headered event

This commit is contained in:
Neil Alexander 2020-06-30 14:14:38 +01:00
parent f31be26df4
commit 2caaaf7a68

View file

@ -17,6 +17,7 @@ package queue
import ( import (
"context" "context"
"crypto/ed25519" "crypto/ed25519"
"encoding/json"
"fmt" "fmt"
"sync" "sync"
@ -121,7 +122,12 @@ func (oqs *OutgoingQueues) SendEvent(
"destinations": destinations, "event": ev.EventID(), "destinations": destinations, "event": ev.EventID(),
}).Info("Sending event") }).Info("Sending event")
nid, err := oqs.db.StoreJSON(context.TODO(), string(ev.JSON())) headeredJSON, err := json.Marshal(ev)
if err != nil {
return fmt.Errorf("json.Marshal: %w", err)
}
nid, err := oqs.db.StoreJSON(context.TODO(), string(headeredJSON))
if err != nil { if err != nil {
return fmt.Errorf("sendevent: oqs.db.StoreJSON: %w", err) return fmt.Errorf("sendevent: oqs.db.StoreJSON: %w", err)
} }