summaryrefslogtreecommitdiff
path: root/pkg/api/server
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-09-25 18:22:50 +0000
committerGitHub <noreply@github.com>2020-09-25 18:22:50 +0000
commitbb8e77d7f42ae361d11161239bd5c7ac6fa5d719 (patch)
treeb5baf2651f434559093921a4948b1924682d3b6a /pkg/api/server
parent17db9851d05544ef49f8bce0deec452a99aae2a9 (diff)
parent65f2f1a7639eb5bc12e6c522c111be18786870c9 (diff)
downloadpodman-bb8e77d7f42ae361d11161239bd5c7ac6fa5d719.tar.gz
podman-bb8e77d7f42ae361d11161239bd5c7ac6fa5d719.tar.bz2
podman-bb8e77d7f42ae361d11161239bd5c7ac6fa5d719.zip
Merge pull request #7785 from mheon/backports_211
Backports for v2.1.1
Diffstat (limited to 'pkg/api/server')
-rw-r--r--pkg/api/server/handler_api.go17
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)
}