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"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type JsonMessageHeader struct {
|
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) {
|
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))
|
jmessages := make([]*JsonMessageHeader, len(messages))
|
||||||
for i, msg := range messages {
|
for i, msg := range messages {
|
||||||
jmessages[i] = &JsonMessageHeader{
|
jmessages[i] = &JsonMessageHeader{
|
||||||
|
Mailbox: name,
|
||||||
|
Id: msg.Id(),
|
||||||
From: msg.From(),
|
From: msg.From(),
|
||||||
Subject: msg.Subject(),
|
Subject: msg.Subject(),
|
||||||
Date: msg.Date().String(),
|
Date: msg.Date(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return RenderJson(w, jmessages)
|
return RenderJson(w, jmessages)
|
||||||
|
|||||||
Reference in New Issue
Block a user