File tree Expand file tree Collapse file tree 2 files changed +3
-1
lines changed
lib/grape/middleware/versioner
spec/grape/middleware/versioner Expand file tree Collapse file tree 2 files changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ module Versioner
2323 # route.
2424 class Header < Base
2525 def before
26- accept = env [ 'HTTP_ACCEPT' ]
26+ accept = env [ 'HTTP_ACCEPT' ] || ""
2727
2828 if options [ :version_options ] && options [ :version_options ] . keys . include? ( :strict ) && options [ :version_options ] [ :strict ]
2929 if ( accept . nil? || accept . empty? ) && options [ :versions ] && options [ :version_options ] [ :using ] == :header
Original file line number Diff line number Diff line change 5757 :version_options => { :using => :header }
5858 }
5959 subject . call ( 'HTTP_ACCEPT' => '' ) . first . should == 200
60+ subject . call ( { } ) . first . should == 200
6061 end
6162
6263 it 'should return a 200 when no header is set but strict header based versioning is disabled' do
6566 :version_options => { :using => :header , :strict => false }
6667 }
6768 subject . call ( 'HTTP_ACCEPT' => '' ) . first . should == 200
69+ subject . call ( { } ) . first . should == 200
6870 end
6971
7072 it 'should return a 404 when no header is set but strict header based versioning is used' do
You can’t perform that action at this time.
0 commit comments