1
0
Fork 0
mirror of https://github.com/vbatts/srvdav.git synced 2024-11-28 19:35:39 +00:00
srvdav/vendor/github.com/samedi/caldav-go/handlers/builder.go

24 lines
662 B
Go

package handlers
import (
"net/http"
)
type handlerInterface interface {
Handle() *Response
}
func NewHandler(request *http.Request) handlerInterface {
response := NewResponse()
switch request.Method {
case "GET": return getHandler{request, response, false}
case "HEAD": return getHandler{request, response, true}
case "PUT": return putHandler{request, response}
case "DELETE": return deleteHandler{request, response}
case "PROPFIND": return propfindHandler{request, response}
case "OPTIONS": return optionsHandler{response}
case "REPORT": return reportHandler{request, response}
default: return notImplementedHandler{response}
}
}