# File lib/grape/middleware/versioner/accept_version_header.rb, line 20 def before potential_version = (env[Grape::Http::Headers::HTTP_ACCEPT_VERSION] || '').strip if strict? # If no Accept-Version header: if potential_version.empty? throw :error, status: 406, headers: error_headers, message: 'Accept-Version header must be set.' end end return if potential_version.empty? # If the requested version is not supported: throw :error, status: 406, headers: error_headers, message: 'The requested version is not supported.' unless versions.any? { |v| v.to_s == potential_version } env[Grape::Env::API_VERSION] = potential_version end