File tree 2 files changed +6
-7
lines changed 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ def block_response(env, options)
87
87
body << content ( content_type )
88
88
89
89
Response . new (
90
- status : options [ 'status_code' ] || 403 ,
90
+ status : options [ 'status_code' ] &. to_i || 403 ,
91
91
headers : { 'Content-Type' => content_type } ,
92
92
body : body ,
93
93
)
@@ -97,15 +97,14 @@ def redirect_response(env, options)
97
97
if options [ 'location' ] && !options [ 'location' ] . empty?
98
98
content_type = content_type ( env )
99
99
100
- status = options [ 'status_code' ] >= 300 && options [ 'status_code' ] < 400 ? options [ 'status_code' ] : 303
101
-
102
100
headers = {
103
101
'Content-Type' => content_type ,
104
102
'Location' => options [ 'location' ]
105
103
}
106
104
105
+ status_code = options [ 'status_code' ] . to_i
107
106
Response . new (
108
- status : status ,
107
+ status : ( status_code >= 300 && status_code < 400 ? status_code : 303 ) ,
109
108
headers : headers ,
110
109
body : [ ] ,
111
110
)
Original file line number Diff line number Diff line change 21
21
end
22
22
23
23
let ( :type ) { 'html' }
24
- let ( :status_code ) { 100 }
24
+ let ( :status_code ) { ' 100' }
25
25
26
26
context 'status_code' do
27
27
subject ( :status ) { described_class . negotiate ( env , actions ) . status }
92
92
end
93
93
94
94
let ( :location ) { 'foo' }
95
- let ( :status_code ) { 303 }
95
+ let ( :status_code ) { ' 303' }
96
96
97
97
context 'status_code' do
98
98
subject ( :status ) { described_class . negotiate ( env , actions ) . status }
99
99
100
100
it { is_expected . to eq 303 }
101
101
102
102
context 'when status code do not starts with 3' do
103
- let ( :status_code ) { 202 }
103
+ let ( :status_code ) { ' 202' }
104
104
105
105
it { is_expected . to eq 303 }
106
106
end
You can’t perform that action at this time.
0 commit comments