Retrieve time through X-FIC-Time header instead of time.json
This commit is contained in:
parent
c33390fa80
commit
6034246015
11 changed files with 107 additions and 131 deletions
|
|
@ -8,6 +8,7 @@ import (
|
|||
"log"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"srs.epita.fr/fic-server/libfic"
|
||||
|
||||
|
|
@ -60,6 +61,8 @@ func apiHandler(f DispatchFunction) func(http.ResponseWriter, *http.Request, htt
|
|||
resStatus = http.StatusNotFound
|
||||
}
|
||||
|
||||
w.Header().Set("X-FIC-Time", fmt.Sprintf("%f", float64(time.Now().UnixNano()/1000)/1000000))
|
||||
|
||||
if str, found := ret.(string); found {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(resStatus)
|
||||
|
|
|
|||
Reference in a new issue