summaryrefslogtreecommitdiffstats
path: root/plugin/hooks.go
diff options
context:
space:
mode:
authorChris <ccbrown112@gmail.com>2017-08-28 11:27:18 -0500
committerGitHub <noreply@github.com>2017-08-28 11:27:18 -0500
commit6215c9159acb85033616d2937edf3d87ef7ca79b (patch)
tree54e53392804bda3a30aa9615fef0cd01ca189152 /plugin/hooks.go
parent510b1a18f5282981a70503c0cde474e121c9e651 (diff)
downloadchat-6215c9159acb85033616d2937edf3d87ef7ca79b.tar.gz
chat-6215c9159acb85033616d2937edf3d87ef7ca79b.tar.bz2
chat-6215c9159acb85033616d2937edf3d87ef7ca79b.zip
add plugin http handler (#7289)
Diffstat (limited to 'plugin/hooks.go')
-rw-r--r--plugin/hooks.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/plugin/hooks.go b/plugin/hooks.go
index 28a762a1a..336e56ccb 100644
--- a/plugin/hooks.go
+++ b/plugin/hooks.go
@@ -1,5 +1,9 @@
package plugin
+import (
+ "net/http"
+)
+
type Hooks interface {
// OnActivate is invoked when the plugin is activated.
OnActivate(API) error
@@ -7,4 +11,11 @@ type Hooks interface {
// OnDeactivate is invoked when the plugin is deactivated. This is the plugin's last chance to
// use the API, and the plugin will be terminated shortly after this invocation.
OnDeactivate() error
+
+ // ServeHTTP allows the plugin to implement the http.Handler interface. Requests destined for
+ // the /plugins/{id} path will be routed to the plugin.
+ //
+ // The Mattermost-User-Id header will be present if (and only if) the request is by an
+ // authenticated user.
+ ServeHTTP(http.ResponseWriter, *http.Request)
}