Class: ConvenientService::Examples::Standard::RequestParams::Utils::HTTP::Request::ParseBody
- Inherits:
-
Command
- Object
- ConvenientService::Examples::Standard::RequestParams::Utils::HTTP::Request::ParseBody
- Defined in:
- lib/convenient_service/examples/standard/request_params/utils/http/request/parse_body.rb
Overview
TODO: Specs.
Instance Attribute Summary collapse
-
#http_string ⇒ Object
readonly
Returns the value of attribute http_string.
Instance Method Summary collapse
-
#call ⇒ Object
IMPORTANT: Make sure length is set in
http_string
. -
#initialize(http_string:) ⇒ ParseBody
constructor
A new instance of ParseBody.
Constructor Details
#initialize(http_string:) ⇒ ParseBody
Returns a new instance of ParseBody.
16 17 18 |
# File 'lib/convenient_service/examples/standard/request_params/utils/http/request/parse_body.rb', line 16 def initialize(http_string:) @http_string = http_string end |
Instance Attribute Details
#http_string ⇒ Object (readonly)
Returns the value of attribute http_string.
14 15 16 |
# File 'lib/convenient_service/examples/standard/request_params/utils/http/request/parse_body.rb', line 14 def http_string @http_string end |
Instance Method Details
#call ⇒ Object
IMPORTANT: Make sure length is set in http_string
.
26 27 28 29 30 31 32 33 34 |
# File 'lib/convenient_service/examples/standard/request_params/utils/http/request/parse_body.rb', line 26 def call webrick_request = ::WEBrick::HTTPRequest.new(::WEBrick::Config::HTTP) webrick_request.parse(::StringIO.new(http_string)) webrick_request.body rescue ::WEBrick::HTTPStatus::BadRequest nil end |