mirror of
https://github.com/openfaas/faas.git
synced 2025-06-22 23:03:24 +00:00
Migrate away from requests package for Function structs
The function deployment and status structs have been moved away into the faas-provider package. Tested with a build, running tests, and CI. Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
This commit is contained in:
committed by
Alex Ellis
parent
8767514527
commit
df97efafae
10
gateway/vendor/github.com/openfaas/faas-provider/proxy/proxy.go
generated
vendored
10
gateway/vendor/github.com/openfaas/faas-provider/proxy/proxy.go
generated
vendored
@ -29,7 +29,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/openfaas/faas-provider/httputils"
|
||||
"github.com/openfaas/faas-provider/httputil"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -112,7 +112,7 @@ func proxyRequest(w http.ResponseWriter, originalReq *http.Request, proxyClient
|
||||
pathVars := mux.Vars(originalReq)
|
||||
functionName := pathVars["name"]
|
||||
if functionName == "" {
|
||||
httputils.Errorf(w, http.StatusBadRequest, errMissingFunctionName)
|
||||
httputil.Errorf(w, http.StatusBadRequest, errMissingFunctionName)
|
||||
return
|
||||
}
|
||||
|
||||
@ -120,13 +120,13 @@ func proxyRequest(w http.ResponseWriter, originalReq *http.Request, proxyClient
|
||||
if resolveErr != nil {
|
||||
// TODO: Should record the 404/not found error in Prometheus.
|
||||
log.Printf("resolver error: cannot find %s: %s\n", functionName, resolveErr.Error())
|
||||
httputils.Errorf(w, http.StatusNotFound, "Cannot find service: %s.", functionName)
|
||||
httputil.Errorf(w, http.StatusNotFound, "Cannot find service: %s.", functionName)
|
||||
return
|
||||
}
|
||||
|
||||
proxyReq, err := buildProxyRequest(originalReq, functionAddr, pathVars["params"])
|
||||
if err != nil {
|
||||
httputils.Errorf(w, http.StatusInternalServerError, "Failed to resolve service: %s.", functionName)
|
||||
httputil.Errorf(w, http.StatusInternalServerError, "Failed to resolve service: %s.", functionName)
|
||||
return
|
||||
}
|
||||
if proxyReq.Body != nil {
|
||||
@ -140,7 +140,7 @@ func proxyRequest(w http.ResponseWriter, originalReq *http.Request, proxyClient
|
||||
if err != nil {
|
||||
log.Printf("error with proxy request to: %s, %s\n", proxyReq.URL.String(), err.Error())
|
||||
|
||||
httputils.Errorf(w, http.StatusInternalServerError, "Can't reach service for: %s.", functionName)
|
||||
httputil.Errorf(w, http.StatusInternalServerError, "Can't reach service for: %s.", functionName)
|
||||
return
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user