use HttpHandler type
This commit is contained in:
parent
07011a947e
commit
f14d47f34a
@ -7,11 +7,13 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type HttpHandler func(http.ResponseWriter, *http.Request)
|
||||||
|
|
||||||
func Exit(_ http.ResponseWriter, _ *http.Request) {
|
func Exit(_ http.ResponseWriter, _ *http.Request) {
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func CreateVersionHandler() func(w http.ResponseWriter, r *http.Request) {
|
func CreateVersionHandler() HttpHandler {
|
||||||
startTime := time.Now().Unix()
|
startTime := time.Now().Unix()
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
fmt.Fprintf(w, "%d\n", startTime)
|
fmt.Fprintf(w, "%d\n", startTime)
|
||||||
|
@ -11,7 +11,7 @@ type Value struct {
|
|||||||
Value int
|
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) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
refId, err := strconv.Atoi(r.URL.Query().Get("ref"))
|
refId, err := strconv.Atoi(r.URL.Query().Get("ref"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user