There was an error while loading. Please reload this page.
1 parent a5dce0c commit 4b3a1bbCopy full SHA for 4b3a1bb
1 file changed
api/server/httputils/httputils.go
@@ -78,13 +78,14 @@ func ParseForm(r *http.Request) error {
78
79
// VersionFromContext returns an API version from the context using APIVersionKey.
80
// It panics if the context value does not have version.Version type.
81
-func VersionFromContext(ctx context.Context) (ver string) {
+func VersionFromContext(ctx context.Context) string {
82
if ctx == nil {
83
- return
+ return ""
84
}
85
- val := ctx.Value(APIVersionKey)
86
- if val == nil {
87
+
+ if val := ctx.Value(APIVersionKey); val != nil {
+ return val.(string)
88
89
- return val.(string)
90
91
0 commit comments