Class: HttpClientGenerator::Plugs::CamelizeBody
- Inherits:
-
Object
- Object
- HttpClientGenerator::Plugs::CamelizeBody
- Defined in:
- lib/http_client_generator/plugs/camelize_body.rb
Instance Method Summary collapse
Instance Method Details
#call(req) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/http_client_generator/plugs/camelize_body.rb', line 8 def call(req) body = if req.json? && req.body.is_a?(Hash) req.body.deep_transform_keys { |key| key.to_s.camelize(:lower).to_sym } else req.body end req.body = body req end |