Skip to content

Commit

Permalink
SMTP: Adding body_size to metadata endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Hinderberger committed Jun 24, 2024
1 parent a9a9fbf commit 132505f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/smtp/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ func (h *smtpHTTPHandler) handleMessageMeta(w http.ResponseWriter, r *http.Reque

out := buildMessageBasicMeta(msg, idx)

out["body_size"] = len(msg.Body())

headers := make(map[string]any)
for k, v := range msg.Headers() {
headers[k] = v
Expand Down Expand Up @@ -242,7 +244,8 @@ func buildMessageBasicMeta(msg *ReceivedMessage, idx int) map[string]any {

func buildMultipartMeta(part *ReceivedPart, partIdx int) map[string]any {
out := map[string]any{
"idx": partIdx,
"idx": partIdx,
"body_size": len(part.Body()),
}

headers := make(map[string]any)
Expand Down

0 comments on commit 132505f

Please sign in to comment.