1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-18 10:07:02 +00:00

Can now list mailbox contents via REST

This commit is contained in:
James Hillyerd
2013-10-11 14:42:00 -07:00
parent 27015b3c58
commit a12147930c
4 changed files with 55 additions and 5 deletions

13
web/rest.go Normal file
View File

@@ -0,0 +1,13 @@
package web
import (
"encoding/json"
"net/http"
)
func RenderJson(w http.ResponseWriter, data interface{}) error {
w.Header().Set("Content-Type", "application/json; charset=utf-8")
w.Header().Set("Expires", "-1")
enc := json.NewEncoder(w)
return enc.Encode(data)
}