use HttpHandler type

This commit is contained in:
Settel 2021-07-29 18:42:52 +02:00
parent 07011a947e
commit f14d47f34a
2 changed files with 4 additions and 2 deletions

View File

@ -7,11 +7,13 @@ import (
"time"
)
type HttpHandler func(http.ResponseWriter, *http.Request)
func Exit(_ http.ResponseWriter, _ *http.Request) {
os.Exit(0)
}
func CreateVersionHandler() func(w http.ResponseWriter, r *http.Request) {
func CreateVersionHandler() HttpHandler {
startTime := time.Now().Unix()
return func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "%d\n", startTime)

View File

@ -11,7 +11,7 @@ type Value struct {
Value int
}
func SyncFactory(obs observer.Property) func(http.ResponseWriter, *http.Request) {
func SyncFactory(obs observer.Property) HttpHandler {
return func(w http.ResponseWriter, r *http.Request) {
refId, err := strconv.Atoi(r.URL.Query().Get("ref"))
if err != nil {