Documentation
¶
Overview ¶
this is gutted/extended from https://github.com/phayes/hookserve/ TODO(jesse): could clean this up alot
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidEventFormat = errors.New("Unable to parse event string. Invalid Format.")
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct { Owner string // The username of the owner of the repository Repo string // The name of the repository Ref string // The ref on the event Branch string // The branch the event took place on Commit string // The head commit hash attached to the event Type string // Can be either "pull_request", "push", "create_tag", "create_branch" BaseOwner string // For Pull Requests, contains the base owner BaseRepo string // For Pull Requests, contains the base repo BaseBranch string // For Pull Requests, contains the base branch }
type Server ¶
type Server struct { Port int // Port to listen on. Defaults to 80 Path string // Path to receive on. Defaults to "/postreceive" Secret string // Option secret key for authenticating via HMAC Events chan Event // Channel of events. Read from this channel to get push events as they happen. }
func NewServer ¶
func NewServer() *Server
Create a new server with sensible defaults. By default the Port is set to 80 and the Path is set to `/postreceive`
func (*Server) ServeHTTP ¶
func (s *Server) ServeHTTP(w http.ResponseWriter, req *http.Request)
Satisfies the http.Handler interface. Instead of calling Server.ListenAndServe you can integrate hookserve.Server inside your own http server. If you are using hookserve.Server in his way Server.Path should be set to match your mux pattern and Server.Port will be ignored.
func (*Server) ServeHTTPRouter ¶
func (s *Server) ServeHTTPRouter(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
Satisfies the extended httpRouter handler interface which has a paramater
Click to show internal directories.
Click to hide internal directories.