Captain Hook - Web hook server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

47 lines
663 B

package main
import (
"io"
"log"
"net/http"
)
type HookHandler interface {
ServeHTTP(http.ResponseWriter, *http.Request)
}
type Condition struct {
selector string
tester string
value string
}
type Hook struct {
Name string
params []Condition
actions []string
}
type ByName []Hook
func (h ByName) Len() int {
return len(h)
}
func (h ByName) Less(i, j int) bool {
return h[i].Name < h[j].Name
}
func (h ByName) Swap(i, j int) {
h[i], h[j] = h[j], h[i]
}
func (h Hook) String() string {
return h.Name
}
func (h Hook) ServeHTTP(w http.ResponseWriter, r *http.Request) {
log.Println(r.URL.String())
io.WriteString(w, h.Name+"\n")
}