Method: Api::ApiClient#build_request_body
- Defined in:
- lib/jamm/api/api_client.rb
#build_request_body(header_params, form_params, body) ⇒ String
Builds the HTTP request body
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/jamm/api/api_client.rb', line 132 def build_request_body(header_params, form_params, body) # http form if header_params['Content-Type'] == 'application/x-www-form-urlencoded' || header_params['Content-Type'] == 'multipart/form-data' data = {} form_params.each do |key, value| data[key] = case value when ::File, ::Array, nil # let typhoeus handle File, Array and nil parameters value else value.to_s end end elsif body data = body.is_a?(String) ? body : body.to_json else data = nil end data end |