Completed webhooks package documentation

This commit is contained in:
joeybloggs
2015-10-30 10:50:43 -04:00
parent 92184e3d56
commit 3def7b0883
+2 -3
View File
@@ -61,11 +61,9 @@ func RunServer(s *http.Server, hook Webhook, path string) error {
// RunTLSServer runs a custom server with TLS configuration. // RunTLSServer runs a custom server with TLS configuration.
// NOTE: http.Server Handler will be overridden by this library, just set it to nil. // NOTE: http.Server Handler will be overridden by this library, just set it to nil.
// Setting the Certificates can be done in the http.Server.TLSConfig.Certificates // Setting the Certificates can be done in the http.Server.TLSConfig.Certificates
// see example here: // see example here: https://github.com/joeybloggs/webhooks/blob/master/webhooks_test.go#L178
func RunTLSServer(s *http.Server, hook Webhook, path string) error { func RunTLSServer(s *http.Server, hook Webhook, path string) error {
// var err error
srv := &server{ srv := &server{
hook: hook, hook: hook,
path: path, path: path,
@@ -76,6 +74,7 @@ func RunTLSServer(s *http.Server, hook Webhook, path string) error {
return s.ListenAndServeTLS("", "") return s.ListenAndServeTLS("", "")
} }
// ServeHTTP is the Handler for every posted WebHook Event
func (s *server) ServeHTTP(w http.ResponseWriter, r *http.Request) { func (s *server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
defer r.Body.Close() defer r.Body.Close()