mirror of
https://github.com/openfaas/faas.git
synced 2025-06-10 01:06:47 +00:00
Simple switch to enable 'GET' method'
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
This commit is contained in:
parent
b2c579370a
commit
c132195a5c
@ -45,12 +45,13 @@ func MakeProxy(metrics metrics.MetricOptions, wildcard bool, client *client.Clie
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
defer r.Body.Close()
|
||||
|
||||
if r.Method == "POST" {
|
||||
switch r.Method {
|
||||
case "POST", "GET":
|
||||
logger.Infoln(r.Header)
|
||||
|
||||
xfunctionHeader := r.Header["X-Function"]
|
||||
if len(xfunctionHeader) > 0 {
|
||||
logger.Infoln(xfunctionHeader)
|
||||
xFunctionHeader := r.Header["X-Function"]
|
||||
if len(xFunctionHeader) > 0 {
|
||||
logger.Infoln(xFunctionHeader)
|
||||
}
|
||||
|
||||
// getServiceName
|
||||
@ -59,8 +60,8 @@ func MakeProxy(metrics metrics.MetricOptions, wildcard bool, client *client.Clie
|
||||
vars := mux.Vars(r)
|
||||
name := vars["name"]
|
||||
serviceName = name
|
||||
} else if len(xfunctionHeader) > 0 {
|
||||
serviceName = xfunctionHeader[0]
|
||||
} else if len(xFunctionHeader) > 0 {
|
||||
serviceName = xFunctionHeader[0]
|
||||
}
|
||||
|
||||
if len(serviceName) > 0 {
|
||||
@ -69,8 +70,8 @@ func MakeProxy(metrics metrics.MetricOptions, wildcard bool, client *client.Clie
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
w.Write([]byte("Provide an x-function header or valid route /function/function_name."))
|
||||
}
|
||||
|
||||
} else {
|
||||
break
|
||||
default:
|
||||
w.WriteHeader(http.StatusMethodNotAllowed)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user