Class: Foobara::CommandConnectors::Http::Rack::Request
- Inherits:
-
Http::Request
- Object
- Http::Request
- Foobara::CommandConnectors::Http::Rack::Request
- Defined in:
- lib/foobara/command_connectors/http/rack/request.rb
Instance Attribute Summary collapse
-
#env ⇒ Object
Returns the value of attribute env.
Instance Method Summary collapse
-
#initialize(env, prefix: nil) ⇒ Request
constructor
A new instance of Request.
Constructor Details
#initialize(env, prefix: nil) ⇒ Request
Returns a new instance of Request.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/foobara/command_connectors/http/rack/request.rb', line 8 def initialize(env, prefix: nil) self.env = env scheme = if env["HTTP_X_FORWARDED_PROTO"] == "https" || env["HTTPS"] == "on" "https" else "http" end super( scheme:, host: env["SERVER_NAME"], port: env["SERVER_PORT"], path: env["PATH_INFO"], query_string: env["QUERY_STRING"], method: env["REQUEST_METHOD"], # TODO: should we delay this read instead of eager-loading this? body: env["rack.input"]&.read || "", headers: extract_headers, cookies: ::Rack::Utils.(env), remote_ip: env["REMOTE_ADDR"], prefix: ) end |
Instance Attribute Details
#env ⇒ Object
Returns the value of attribute env.
6 7 8 |
# File 'lib/foobara/command_connectors/http/rack/request.rb', line 6 def env @env end |