module Rack::Request::Helpers

def form_data?

content-type header is provided and the request_method is POST.
A request body is also assumed to contain form-data when no

+FORM_DATA_MEDIA_TYPES+ array.
list of form-data media types can be modified through the
"application/x-www-form-urlencoded" or "multipart/form-data". The
the request content-type for one of the media-types:
Determine whether the request body contains form-data by checking
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