mirror of
https://github.com/jhillyerd/inbucket.git
synced 2025-12-18 10:07:02 +00:00
Change format of json msg header
This commit is contained in:
1
bin/mailbox-source.sh
Executable file
1
bin/mailbox-source.sh
Executable file
@@ -0,0 +1 @@
|
||||
curl -i -H "Accept: application/json" --noproxy localhost http://localhost:9000/mailbox/source/$1/$2
|
||||
@@ -7,10 +7,12 @@ import (
|
||||
"io"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
type JsonMessageHeader struct {
|
||||
From, Subject, Date string
|
||||
Mailbox, Id, From, Subject string
|
||||
Date time.Time
|
||||
}
|
||||
|
||||
func MailboxIndex(w http.ResponseWriter, req *http.Request, ctx *Context) (err error) {
|
||||
@@ -45,9 +47,11 @@ func MailboxList(w http.ResponseWriter, req *http.Request, ctx *Context) (err er
|
||||
jmessages := make([]*JsonMessageHeader, len(messages))
|
||||
for i, msg := range messages {
|
||||
jmessages[i] = &JsonMessageHeader{
|
||||
Mailbox: name,
|
||||
Id: msg.Id(),
|
||||
From: msg.From(),
|
||||
Subject: msg.Subject(),
|
||||
Date: msg.Date().String(),
|
||||
Date: msg.Date(),
|
||||
}
|
||||
}
|
||||
return RenderJson(w, jmessages)
|
||||
|
||||
Reference in New Issue
Block a user