Update faas-provider version

Signed-off-by: Alex Ellis <alexellis2@gmail.com>
This commit is contained in:
Alex Ellis
2019-06-08 10:16:30 +01:00
parent 678e93599e
commit 701708fe0e
11 changed files with 167 additions and 18 deletions

View File

@ -129,7 +129,9 @@ func proxyRequest(w http.ResponseWriter, originalReq *http.Request, proxyClient
writeError(w, http.StatusInternalServerError, "Failed to resolve service: %s.", functionName)
return
}
defer proxyReq.Body.Close()
if proxyReq.Body != nil {
defer proxyReq.Body.Close()
}
start := time.Now()
response, err := proxyClient.Do(proxyReq.WithContext(ctx))
@ -148,7 +150,7 @@ func proxyRequest(w http.ResponseWriter, originalReq *http.Request, proxyClient
copyHeaders(clientHeader, &response.Header)
w.Header().Set("Content-Type", getContentType(response.Header, originalReq.Header))
w.WriteHeader(http.StatusOK)
w.WriteHeader(response.StatusCode)
io.Copy(w, response.Body)
}