Class: Sparrow::RequestMiddleware
Instance Attribute Summary
Attributes inherited from Middleware
#app, #body, #headers, #ignored_response_codes, #status
Instance Method Summary
collapse
Methods inherited from Middleware
#call, #initialize
Instance Method Details
#content_type ⇒ Object
9
10
11
|
# File 'lib/sparrow/request_middleware.rb', line 9
def content_type
http_message.content_type.presence
end
|
#convert(env) ⇒ Object
3
4
5
6
7
|
# File 'lib/sparrow/request_middleware.rb', line 3
def convert(env)
super
strategy.handle(env, :request)
env
end
|
#http_message ⇒ Object
23
24
25
|
# File 'lib/sparrow/request_middleware.rb', line 23
def http_message
RequestHttpMessage.new(last_env)
end
|
#strategy ⇒ Object
13
14
15
16
17
18
19
20
21
|
# File 'lib/sparrow/request_middleware.rb', line 13
def strategy
if steward.has_processable_http_message? &&
http_message.form_hash?
Sparrow.logger.debug 'Choosing strategy FormHash'
Strategies::FormHash
else
super
end
end
|