code: func (v VersionMiddleware) WrapHandler(handler func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error) func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
  	return func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
  		w.Header().Set("Server", fmt.Sprintf("Docker/%s (%s)", v.serverVersion, runtime.GOOS))
  		w.Header().Set("API-Version", v.defaultVersion)
  		w.Header().Set("OSType", runtime.GOOS)
  
  		apiVersion := vars["version"]
  		if apiVersion == "" {
  			apiVersion = v.defaultVersion
  		}
  		if versions.LessThan(apiVersion, v.minVersion) {
  			return versionUnsupportedError{version: apiVersion, minVersion: v.minVersion}
  		}
  		if versions.GreaterThan(apiVersion, v.defaultVersion) {
  			return versionUnsupportedError{version: apiVersion, maxVersion: v.defaultVersion}
  		}
  		ctx = context.WithValue(ctx, httputils.APIVersionKey{}, apiVersion)
  		return handler(ctx, w, r, vars)
  	}
  
  }
docs: // WrapHandler returns a new handler function wrapping the previous one in the request chain.