summaryrefslogtreecommitdiffstats
path: root/api/context.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-07-04 16:12:02 -0400
committerGitHub <noreply@github.com>2017-07-04 16:12:02 -0400
commit8ec8948c84e946fde736add0c4e6dd55f6efd1ab (patch)
treeb6388c965c797d4dfe9c860b93b4249107b9a7b0 /api/context.go
parent4bd7b68b24137a9f8fe0abc908831cf95bb6c32b (diff)
downloadchat-8ec8948c84e946fde736add0c4e6dd55f6efd1ab.tar.gz
chat-8ec8948c84e946fde736add0c4e6dd55f6efd1ab.tar.bz2
chat-8ec8948c84e946fde736add0c4e6dd55f6efd1ab.zip
PLT-6554 Add config setting to control enabling API version 3 (#6835)
* Add config setting to control enabling API version 3 * Update help text for APIv3 config setting (#6843) * Update configuration_settings.jsx * Update en.json
Diffstat (limited to 'api/context.go')
-rw-r--r--api/context.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/api/context.go b/api/context.go
index 6d1e758e8..09cb1e583 100644
--- a/api/context.go
+++ b/api/context.go
@@ -205,6 +205,10 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
c.Path = "/" + strings.Join(splitURL[2:], "/")
}
+ if h.isApi && !*utils.Cfg.ServiceSettings.EnableAPIv3 {
+ c.Err = model.NewAppError("ServeHTTP", "api.context.v3_disabled.app_error", nil, "", http.StatusNotImplemented)
+ }
+
if c.Err == nil && h.requireUser {
c.UserRequired()
}