Files
kapow/internal/server/model/handler.go
pancho horrillo 2129c4a1f6 internal/server/model.Handler.Route is no longer a pointer
Also Spawn() now checks if entrypoint is not set

Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com>
2019-10-10 18:16:15 +02:00

29 lines
663 B
Go

package model
import (
"net/http"
"sync"
)
// Handler represents an open HTTP connection in the User Server.
//
// This struct contains the connection Writer and Request to be managed
// by endpoints of the Data Server.
type Handler struct {
// ID is unique identifier of the request.
ID string
// Route is the original route that matched this request.
Route
// Writing is a mutex that prevents two goroutines from writing at
// the same time in the response.
Writing sync.Mutex
// Request is a pointer to the in-progress request.
Request *http.Request
// Writer is the original http.ResponseWriter of the request.
Writer http.ResponseWriter
}