diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-09-22 18:41:01 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-22 18:41:01 +0000 |
commit | a7c7cd21e44b10a31ce7840d4d36f1c9c2048dc1 (patch) | |
tree | fe94369ab7eb09656a1ae9850e7138ec522ca3cd /pkg | |
parent | 961a3d03c81f2c4083f0260ad688644371544a00 (diff) | |
parent | 23bd99623e5ec85642b331ec5f76698bbf2ed588 (diff) | |
download | podman-a7c7cd21e44b10a31ce7840d4d36f1c9c2048dc1.tar.gz podman-a7c7cd21e44b10a31ce7840d4d36f1c9c2048dc1.tar.bz2 podman-a7c7cd21e44b10a31ce7840d4d36f1c9c2048dc1.zip |
Merge pull request #7730 from jwhonce/wip/headers
Add Server header to API service responses
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/api/server/handler_api.go | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/pkg/api/server/handler_api.go b/pkg/api/server/handler_api.go index f2ce0301b..920811c51 100644 --- a/pkg/api/server/handler_api.go +++ b/pkg/api/server/handler_api.go @@ -34,15 +34,18 @@ func (s *APIServer) APIHandler(h http.HandlerFunc) http.HandlerFunc { } // TODO: Use r.ConnContext when ported to go 1.13 - c := context.WithValue(r.Context(), "decoder", s.Decoder) //nolint - c = context.WithValue(c, "runtime", s.Runtime) //nolint - c = context.WithValue(c, "shutdownFunc", s.Shutdown) //nolint - c = context.WithValue(c, "idletracker", s.idleTracker) //nolint + c := context.WithValue(r.Context(), "decoder", s.Decoder) // nolint + c = context.WithValue(c, "runtime", s.Runtime) // nolint + c = context.WithValue(c, "shutdownFunc", s.Shutdown) // nolint + c = context.WithValue(c, "idletracker", s.idleTracker) // nolint r = r.WithContext(c) - v := utils.APIVersion[utils.CompatTree][utils.CurrentAPIVersion] - w.Header().Set("API-Version", fmt.Sprintf("%d.%d", v.Major, v.Minor)) - w.Header().Set("Libpod-API-Version", utils.APIVersion[utils.LibpodTree][utils.CurrentAPIVersion].String()) + cv := utils.APIVersion[utils.CompatTree][utils.CurrentAPIVersion] + w.Header().Set("API-Version", fmt.Sprintf("%d.%d", cv.Major, cv.Minor)) + + lv := utils.APIVersion[utils.LibpodTree][utils.CurrentAPIVersion].String() + w.Header().Set("Libpod-API-Version", lv) + w.Header().Set("Server", "Libpod/"+lv+" ("+runtime.GOOS+")") h(w, r) } |