vendoring and caldav
This commit is contained in:
parent
a06aa900b7
commit
fd9092e5ab
96 changed files with 14832 additions and 5 deletions
28
vendor/github.com/samedi/caldav-go/handler.go
generated
vendored
Normal file
28
vendor/github.com/samedi/caldav-go/handler.go
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
package caldav
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"github.com/samedi/caldav-go/data"
|
||||
"github.com/samedi/caldav-go/handlers"
|
||||
)
|
||||
|
||||
// RequestHandler handles the given CALDAV request and writes the reponse righ away. This function is to be
|
||||
// used by passing it directly as the handle func to the `http` lib. Example: http.HandleFunc("/", caldav.RequestHandler).
|
||||
func RequestHandler(writer http.ResponseWriter, request *http.Request) {
|
||||
response := HandleRequest(request)
|
||||
response.Write(writer)
|
||||
}
|
||||
|
||||
// HandleRequest handles the given CALDAV request and returns the response. Useful when the caller
|
||||
// wants to do something else with the response before writing it to the response stream.
|
||||
func HandleRequest(request *http.Request) *handlers.Response {
|
||||
handler := handlers.NewHandler(request)
|
||||
return handler.Handle()
|
||||
}
|
||||
|
||||
// HandleRequestWithStorage handles the request the same way as `HandleRequest` does, but before,
|
||||
// it sets the given storage that will be used throughout the request handling flow.
|
||||
func HandleRequestWithStorage(request *http.Request, stg data.Storage) *handlers.Response {
|
||||
SetupStorage(stg)
|
||||
return HandleRequest(request)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue