Method: Rack::Request::Helpers#form_data?
- Defined in:
- lib/rack/request.rb
permalink #form_data? ⇒ Boolean
Determine whether the request body contains form-data by checking the request content-type for one of the media-types: “application/x-www-form-urlencoded” or “multipart/form-data”. The list of form-data media types can be modified through the FORM_DATA_MEDIA_TYPES
array.
A request body is also assumed to contain form-data when no content-type header is provided and the request_method is POST.
470 471 472 473 474 475 |
# File 'lib/rack/request.rb', line 470 def form_data? type = media_type meth = get_header(RACK_METHODOVERRIDE_ORIGINAL_METHOD) || get_header(REQUEST_METHOD) (meth == POST && type.nil?) || FORM_DATA_MEDIA_TYPES.include?(type) end |