Merge branch 'pr1077'
This commit is contained in:
commit
59550e0fcb
1 file changed
+6
-5
+6
-5
@@ -259,6 +259,12 @@ func handleHTTP(router *weave.Router, httpAddr string, allocator *ipam.Allocator
|
|||||||
allocator.HandleHTTP(muxRouter, defaultSubnet, docker)
|
allocator.HandleHTTP(muxRouter, defaultSubnet, docker)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
muxRouter.Methods("GET").Path("/status").Headers("Accept", "application/json").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
json, _ := router.StatusJSON(version)
|
||||||
|
w.Header().Set("Content-Type", "application/json")
|
||||||
|
w.Write(json)
|
||||||
|
})
|
||||||
|
|
||||||
muxRouter.Methods("GET").Path("/status").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
muxRouter.Methods("GET").Path("/status").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
fmt.Fprintln(w, "weave router", version)
|
fmt.Fprintln(w, "weave router", version)
|
||||||
fmt.Fprintln(w, router.Status())
|
fmt.Fprintln(w, router.Status())
|
||||||
@@ -268,11 +274,6 @@ func handleHTTP(router *weave.Router, httpAddr string, allocator *ipam.Allocator
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
muxRouter.Methods("GET").Path("/status-json").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
||||||
json, _ := router.StatusJSON(version)
|
|
||||||
w.Write(json)
|
|
||||||
})
|
|
||||||
|
|
||||||
muxRouter.Methods("POST").Path("/connect").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
muxRouter.Methods("POST").Path("/connect").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
if err := r.ParseForm(); err != nil {
|
if err := r.ParseForm(); err != nil {
|
||||||
http.Error(w, fmt.Sprint("unable to parse form: ", err), http.StatusBadRequest)
|
http.Error(w, fmt.Sprint("unable to parse form: ", err), http.StatusBadRequest)
|
||||||
|
|||||||
Reference in new issue
Block a user