Better caldav support (#73)
This commit is contained in:
18
vendor/github.com/samedi/caldav-go/handlers/shared.go
generated
vendored
Normal file
18
vendor/github.com/samedi/caldav-go/handlers/shared.go
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// This function reads the request body and restore its content, so that
|
||||
// the request body can be read a second time.
|
||||
func readRequestBody(request *http.Request) string {
|
||||
// Read the content
|
||||
body, _ := ioutil.ReadAll(request.Body)
|
||||
// Restore the io.ReadCloser to its original state
|
||||
request.Body = ioutil.NopCloser(bytes.NewBuffer(body))
|
||||
// Use the content
|
||||
return string(body)
|
||||
}
|
Reference in New Issue
Block a user