(env Envelope)
| 386 | type bodyDecoder func(json.RawMessage) (Body, error) |
| 387 | |
| 388 | func normalizeEnvelopeCopy(env Envelope) Envelope { |
| 389 | return Envelope{ |
| 390 | Protocol: strings.TrimSpace(env.Protocol), |
| 391 | ID: strings.TrimSpace(env.ID), |
| 392 | WorkspaceID: strings.TrimSpace(env.WorkspaceID), |
| 393 | Kind: Kind(strings.TrimSpace(string(env.Kind))), |
| 394 | Channel: strings.TrimSpace(env.Channel), |
| 395 | Surface: normalizeOptionalSurface(env.Surface), |
| 396 | ThreadID: normalizeOptionalIdentifier(env.ThreadID), |
| 397 | DirectID: normalizeOptionalIdentifier(env.DirectID), |
| 398 | From: strings.TrimSpace(env.From), |
| 399 | Mentions: normalizeEnvelopeMentions(env.Mentions), |
| 400 | TS: env.TS, |
| 401 | Body: cloneRawMessage(env.Body), |
| 402 | Proof: cloneProof(env.Proof), |
| 403 | Ext: cloneExtensionMap(env.Ext), |
| 404 | WorkID: normalizeOptionalIdentifier(env.WorkID), |
| 405 | ReplyTo: normalizeOptionalIdentifier(env.ReplyTo), |
| 406 | TraceID: normalizeOptionalIdentifier(env.TraceID), |
| 407 | CausationID: normalizeOptionalIdentifier(env.CausationID), |
| 408 | To: normalizeOptionalIdentifier(env.To), |
| 409 | ExpiresAt: cloneInt64Ptr(env.ExpiresAt), |
| 410 | } |
| 411 | } |
| 412 | |
| 413 | func validateEnvelopeHeader(env Envelope) error { |
| 414 | if env.Protocol == "" { |
no test coverage detected