Module: Ueki::HttpClient::RequestBodyConverter

Defined in:
lib/ueki/http_client/request_body_converter.rb

Class Method Summary collapse

Class Method Details

.call(content_type:, params:) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/ueki/http_client/request_body_converter.rb', line 11

def call(content_type:, params:)
  return if params.nil?

  case content_type
  when "application/json"
    params.to_json
  when "application/x-www-form-urlencoded"
    URI.encode_www_form(params)
  else
    params
  end
end