File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,24 +40,7 @@ def json_endpoint
4040 d . merge ( total : d [ :price ] * d [ :quantity ] * m )
4141 end
4242
43- result = JSON . generate ( items : items , count : items . length )
44-
45- if accept_encodings = request . headers [ 'Accept-Encoding' ]
46- types = accept_encodings . split ( ',' ) . map ( &:strip )
47- if types . include? 'gzip'
48- sio = StringIO . new
49- gz = Zlib ::GzipWriter . new ( sio , 1 )
50- gz . write ( result )
51- gz . close
52- response . headers [ 'content-type' ] = 'application/json'
53- response . headers [ 'content-encoding' ] = 'gzip'
54- send_data sio . string , disposition : :inline
55- else
56- render json : result
57- end
58- else
59- render json : result
60- end
43+ render json : JSON . generate ( items : items , count : items . length )
6144 end
6245
6346 def async_db
Original file line number Diff line number Diff line change @@ -20,12 +20,14 @@ class BenchmarkApp < Rails::Application
2020 # Disable all middleware we don't need
2121 config . middleware . delete ActionDispatch ::HostAuthorization
2222 config . middleware . delete ActionDispatch ::Callbacks
23- config . middleware . delete ActionDispatch ::ActionableExceptions
2423 config . middleware . delete ActionDispatch ::RemoteIp
2524 config . middleware . delete ActionDispatch ::RequestId
2625 config . middleware . delete Rails ::Rack ::Logger
2726 config . middleware . delete ActionDispatch ::ShowExceptions
2827
28+ # Add gzip support
29+ config . middleware . insert Rack ::Deflater
30+
2931 # Catch unknown HTTP methods, routing errors, and mark /upload as binary
3032 config . middleware . insert_before 0 , Class . new {
3133 VALID_METHODS = %w[ GET HEAD POST PUT DELETE PATCH OPTIONS TRACE ] . to_set . freeze
Original file line number Diff line number Diff line change 11{
22 "display_name" : " rails" ,
33 "language" : " Ruby" ,
4- "type" : " tuned " ,
4+ "type" : " production " ,
55 "engine" : " puma" ,
66 "description" : " Ruby on Rails (API mode) on Puma, multi-worker with one worker per CPU core." ,
77 "repo" : " https://github.com/rails/rails" ,
1919 " static"
2020 ],
2121 "maintainers" : []
22- }
22+ }
You can’t perform that action at this time.
0 commit comments