Module: Sinatra::Schema::ParamParsing

Defined in:
lib/sinatra/schema/param_parsing.rb

Instance Method Summary collapse

Instance Method Details

#parse_params(properties) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/sinatra/schema/param_parsing.rb', line 4

def parse_params(properties)
  case request.media_type
  when nil, "application/json"
    parse_json_params
  when "application/x-www-form-urlencoded"
    cast_regular_params(properties)
  else
    raise BadRequest.new("Unsupported media type: #{request.media_type}")
  end
end