1
0
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:
James Hillyerd
2013-10-11 16:40:06 -07:00
parent a12147930c
commit d8ac1d78b0
2 changed files with 7 additions and 2 deletions

1
bin/mailbox-source.sh Executable file
View File

@@ -0,0 +1 @@
curl -i -H "Accept: application/json" --noproxy localhost http://localhost:9000/mailbox/source/$1/$2

View File

@@ -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)