From 0d4ab562afb363f5db37417e6645309c139fa22c Mon Sep 17 00:00:00 2001 From: "Frederick F. Kautz IV" Date: Sun, 2 Nov 2014 19:55:01 -0800 Subject: [PATCH] Adding bucket and object route in gateway --- gateway.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gateway.go b/gateway.go index 554981b9a..c15b5288c 100644 --- a/gateway.go +++ b/gateway.go @@ -10,6 +10,15 @@ func GatewayHandler(w http.ResponseWriter, req *http.Request) { fmt.Fprintf(w, "Gateway") } +func GatewayGetObjectHandler(w http.ResponseWriter, req *http.Request) { + vars := mux.Vars(req) + bucket := vars["bucket"] + object := vars["object"] + fmt.Fprintf(w, "bucket: "+bucket) + fmt.Fprintf(w, "\r") + fmt.Fprintf(w, "object: "+object) +} + func RegisterGatewayHandlers(router *mux.Router) { - router.HandleFunc("/gateway/rpc", GatewayHandler) + router.HandleFunc("/{bucket}/{object:.*}", GatewayGetObjectHandler).Methods("GET") }