frontend: log time.json GET

This commit is contained in:
nemunaire 2016-10-13 19:40:27 +02:00
parent f88068c08d
commit 1129bd68be

View File

@ -3,6 +3,7 @@ package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"time"
)
@ -19,6 +20,8 @@ type timeObject struct {
}
func (t TimeHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
log.Printf("Handling %s request from %s: %s [%s]\n", r.Method, r.RemoteAddr, r.URL.Path, r.UserAgent())
w.Header().Set("Content-Type", "application/json")
if j, err := json.Marshal(timeObject{t.StartTime.Unix(), time.Now().Unix(), int(t.Duration.Seconds())}); err != nil {