lib/grape/middleware/versioner/accept_version_header.rb in grape-0.11.0 vs lib/grape/middleware/versioner/accept_version_header.rb in grape-0.12.0
- old
+ new
@@ -16,11 +16,11 @@
# If version does not match this route, then a 406 is raised with
# X-Cascade header to alert Rack::Mount to attempt the next matched
# route.
class AcceptVersionHeader < Base
def before
- potential_version = (env['HTTP_ACCEPT_VERSION'] || '').strip
+ 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.'
@@ -57,10 +57,10 @@
true
end
end
def error_headers
- cascade? ? { 'X-Cascade' => 'pass' } : {}
+ cascade? ? { Grape::Http::Headers::X_CASCADE => 'pass' } : {}
end
end
end
end
end