File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77class App
88 CONTENT_TYPE = 'Content-Type'
99 PLAINTEXT_TYPE = 'text/plain'
10- KNOWN = %w[ GET POST PUT DELETE PATCH HEAD OPTIONS TRACE CONNECT ] . freeze
1110
1211 def call ( env )
13- if KNOWN . include? ( env [ 'REQUEST_METHOD' ] )
14- case env [ 'PATH_INFO' ]
15- when '/pipeline'
16- render_plain 'ok'
17- when '/baseline11'
18- params = Rack ::Utils . parse_query ( env [ 'QUERY_STRING' ] )
19- total = params [ 'a' ] . to_i + params [ 'b' ] . to_i
20- if env [ 'REQUEST_METHOD' ] == 'POST'
21- body = env [ "rack.input" ] &.read
22- total += body . to_i
23- end
24- render_plain total . to_s
25- when '/baseline2'
26- params = Rack ::Utils . parse_query ( env [ 'QUERY_STRING' ] )
27- total = params [ 'a' ] . to_i + params [ 'b' ] . to_i
28- render_plain total . to_s
29- else
30- [ 404 , { CONTENT_TYPE => PLAINTEXT_TYPE } , [ 'Not found!' ] ]
12+ case env [ 'PATH_INFO' ]
13+ when '/pipeline'
14+ render_plain 'ok'
15+ when '/baseline11'
16+ params = Rack ::Utils . parse_query ( env [ 'QUERY_STRING' ] )
17+ total = params [ 'a' ] . to_i + params [ 'b' ] . to_i
18+ if env [ 'REQUEST_METHOD' ] == 'POST'
19+ body = env [ "rack.input" ] &.read
20+ total += body . to_i
3121 end
22+ render_plain total . to_s
23+ when '/baseline2'
24+ params = Rack ::Utils . parse_query ( env [ 'QUERY_STRING' ] )
25+ total = params [ 'a' ] . to_i + params [ 'b' ] . to_i
26+ render_plain total . to_s
3227 else
33- [ 405 , { CONTENT_TYPE => PLAINTEXT_TYPE } , [ 'Method Not Allowed ' ] ]
28+ [ 404 , { CONTENT_TYPE => PLAINTEXT_TYPE } , [ 'Not found! ' ] ]
3429 end
3530 end
3631
You can’t perform that action at this time.
0 commit comments