@@ -10,88 +10,88 @@ def app
1010 @app ||= Rack ::Builder . new {
1111 use Rack ::MiniProfiler
1212 map '/path2/a' do
13- run lambda { |env | [ 200 , { 'Content-Type' => 'text/html' } , +'<h1>path1</h1>' ] }
13+ run lambda { |env | [ 200 , { Rack :: CONTENT_TYPE => 'text/html' } , +'<h1>path1</h1>' ] }
1414 end
1515 map '/path1/a' do
16- run lambda { |env | [ 200 , { 'Content-Type' => 'text/html' } , +'<h1>path2</h1>' ] }
16+ run lambda { |env | [ 200 , { Rack :: CONTENT_TYPE => 'text/html' } , +'<h1>path2</h1>' ] }
1717 end
1818 map '/cached-resource' do
1919 run lambda { |env |
2020 ims = env [ 'HTTP_IF_MODIFIED_SINCE' ] || ""
2121 if ims . size > 0
22- [ 304 , { 'Content-Type' => 'application/json' } , '' ]
22+ [ 304 , { Rack :: CONTENT_TYPE => 'application/json' } , '' ]
2323 else
24- [ 200 , { 'Content-Type' => 'application/json' , 'Cache-Control' => 'original-cache-control' } , '{"name": "Ryan"}' ]
24+ [ 200 , { Rack :: CONTENT_TYPE => 'application/json' , Rack :: CACHE_CONTROL => 'original-cache-control' } , '{"name": "Ryan"}' ]
2525 end
2626 }
2727 end
2828 map '/post' do
29- run lambda { |env | [ 302 , { 'Content-Type' => 'text/html' } , +'<h1>POST</h1>' ] }
29+ run lambda { |env | [ 302 , { Rack :: CONTENT_TYPE => 'text/html' } , +'<h1>POST</h1>' ] }
3030 end
3131 map '/html' do
32- run lambda { |env | [ 200 , { 'Content-Type' => 'text/html' } , +"<html><BODY><h1>Hi</h1></BODY>\n \t </html>" ] }
32+ run lambda { |env | [ 200 , { Rack :: CONTENT_TYPE => 'text/html' } , +"<html><BODY><h1>Hi</h1></BODY>\n \t </html>" ] }
3333 end
3434 map '/explicitly-allowed-html' do
3535 run lambda { |env |
3636 Rack ::MiniProfiler . authorize_request
37- [ 200 , { 'Content-Type' => 'text/html' } , +"<html><BODY><h1>Hi</h1></BODY>\n \t </html>" ]
37+ [ 200 , { Rack :: CONTENT_TYPE => 'text/html' } , +"<html><BODY><h1>Hi</h1></BODY>\n \t </html>" ]
3838 }
3939 end
4040 map '/implicitbody' do
41- run lambda { |env | [ 200 , { 'Content-Type' => 'text/html' } , +"<html><h1>Hi</h1></html>" ] }
41+ run lambda { |env | [ 200 , { Rack :: CONTENT_TYPE => 'text/html' } , +"<html><h1>Hi</h1></html>" ] }
4242 end
4343 map '/implicitbodyhtml' do
44- run lambda { |env | [ 200 , { 'Content-Type' => 'text/html' } , +"<h1>Hi</h1>" ] }
44+ run lambda { |env | [ 200 , { Rack :: CONTENT_TYPE => 'text/html' } , +"<h1>Hi</h1>" ] }
4545 end
4646 map '/db' do
4747 run lambda { |env |
4848 ::Rack ::MiniProfiler . record_sql ( "I want to be, in a db" , 10 )
49- [ 200 , { 'Content-Type' => 'text/html' } , +'<h1>Hi+db</h1>' ]
49+ [ 200 , { Rack :: CONTENT_TYPE => 'text/html' } , +'<h1>Hi+db</h1>' ]
5050 }
5151 end
5252 map '/3ms' do
5353 run lambda { |env |
5454 sleep ( 0.003 )
55- [ 200 , { 'Content-Type' => 'text/html' } , +'<h1>Hi</h1>' ]
55+ [ 200 , { Rack :: CONTENT_TYPE => 'text/html' } , +'<h1>Hi</h1>' ]
5656 }
5757 end
5858 map '/explicitly-allowed' do
5959 run lambda { |env |
6060 Rack ::MiniProfiler . authorize_request
61- [ 200 , { 'Content-Type' => 'text/html' } , +'<h1>path1</h1>' ]
61+ [ 200 , { Rack :: CONTENT_TYPE => 'text/html' } , +'<h1>path1</h1>' ]
6262 }
6363 end
6464 map '/rails_engine' do
6565 run lambda { |env |
6666 env [ 'SCRIPT_NAME' ] = '/rails_engine' # Rails engines do that
67- [ 200 , { 'Content-Type' => 'text/html' } , +'<html><h1>Hi</h1></html>' ]
67+ [ 200 , { Rack :: CONTENT_TYPE => 'text/html' } , +'<html><h1>Hi</h1></html>' ]
6868 }
6969 end
7070 map '/under_passenger' do
7171 run lambda { |env |
72- [ 200 , { 'Content-Type' => 'text/html' } , +'<html><h1>and I ride and I ride</h1></html>' ]
72+ [ 200 , { Rack :: CONTENT_TYPE => 'text/html' } , +'<html><h1>and I ride and I ride</h1></html>' ]
7373 }
7474 end
7575 map '/create' do
7676 run lambda { |env |
77- [ 201 , { 'Content-Type' => 'text/html' } , +'<html><h1>success</h1></html>' ]
77+ [ 201 , { Rack :: CONTENT_TYPE => 'text/html' } , +'<html><h1>success</h1></html>' ]
7878 }
7979 end
8080 map '/notallowed' do
8181 run lambda { |env |
82- [ 403 , { 'Content-Type' => 'text/html' } , +'<html><h1>you are not allowed here</h1></html>' ]
82+ [ 403 , { Rack :: CONTENT_TYPE => 'text/html' } , +'<html><h1>you are not allowed here</h1></html>' ]
8383 }
8484 end
8585 map '/whoopsie-daisy' do
8686 run lambda { |env |
87- [ 500 , { 'Content-Type' => 'text/html' } , +'<html><h1>whoopsie daisy</h1></html>' ]
87+ [ 500 , { Rack :: CONTENT_TYPE => 'text/html' } , +'<html><h1>whoopsie daisy</h1></html>' ]
8888 }
8989 end
9090 map '/test-snapshots-custom-fields' do
9191 run lambda { |env |
9292 qp = Rack ::Utils . parse_nested_query ( env [ 'QUERY_STRING' ] )
9393 qp . each { |k , v | Rack ::MiniProfiler . add_snapshot_custom_field ( k , v ) }
94- [ 200 , { 'Content-Type' => 'text/html' } , +'<html><h1>custom fields</h1></html>' ]
94+ [ 200 , { Rack :: CONTENT_TYPE => 'text/html' } , +'<html><h1>custom fields</h1></html>' ]
9595 }
9696 end
9797 } . to_app
@@ -450,12 +450,12 @@ def load_prof(response)
450450 describe 'gc profiler' do
451451 it "should return a report" do
452452 get '/html?pp=profile-gc'
453- expect ( last_response [ 'Content-Type' ] ) . to include ( 'text/plain' )
453+ expect ( last_response [ Rack :: CONTENT_TYPE ] ) . to include ( 'text/plain' )
454454 end
455455
456456 it "should return a report when an HTTP header is used" do
457457 get '/html' , nil , { 'HTTP_X_RACK_MINI_PROFILER' => 'profile-gc' }
458- expect ( last_response [ 'Content-Type' ] ) . to include ( 'text/plain' )
458+ expect ( last_response [ Rack :: CONTENT_TYPE ] ) . to include ( 'text/plain' )
459459 end
460460 end
461461
0 commit comments