filebrowser/routes/git/git.go

25 lines
407 B
Go
Raw Normal View History

2016-03-06 13:14:05 +00:00
package git
import (
"errors"
"net/http"
"github.com/hacdias/caddy-hugo/config"
)
2016-03-12 09:52:04 +00:00
var (
conf *config.Config
)
2016-03-06 13:14:05 +00:00
// ServeHTTP is used to serve the content of GIT API.
func ServeHTTP(w http.ResponseWriter, r *http.Request, c *config.Config) (int, error) {
2016-03-12 09:52:04 +00:00
conf = c
2016-03-06 13:14:05 +00:00
switch r.Method {
case "POST":
2016-03-12 09:52:04 +00:00
return POST(w, r)
2016-03-06 13:14:05 +00:00
default:
2016-03-06 14:23:37 +00:00
return http.StatusMethodNotAllowed, errors.New("Invalid method.")
2016-03-06 13:14:05 +00:00
}
}