File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -198,19 +198,20 @@ func (s *Subscriber[H]) verifyMessage(
198
198
}
199
199
}
200
200
201
- func (s * Subscriber [H ]) extractHeader (msg * pubsub.Message ) (H , error ) {
201
+ func (s * Subscriber [H ]) extractHeader (msg * pubsub.Message ) (hdr H , err error ) {
202
202
if msg .ValidatorData != nil {
203
- hdr , ok := msg .ValidatorData .(H )
203
+ var ok bool
204
+ hdr , ok = msg .ValidatorData .(H )
204
205
if ! ok {
205
206
panic (fmt .Sprintf ("msg ValidatorData is of type %T" , msg .ValidatorData ))
206
207
}
207
- return hdr , nil
208
+ } else {
209
+ hdr = header .New [H ]()
210
+ if err := hdr .UnmarshalBinary (msg .Data ); err != nil {
211
+ return hdr , err
212
+ }
208
213
}
209
214
210
- hdr := header .New [H ]()
211
- if err := hdr .UnmarshalBinary (msg .Data ); err != nil {
212
- return hdr , err
213
- }
214
215
if err := hdr .Validate (); err != nil {
215
216
return hdr , err
216
217
}
You can’t perform that action at this time.
0 commit comments