class ActionDispatch::Request

def form_data?

+Content-Type+ header is provided and the request_method is POST.
A request body is not 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?
  FORM_DATA_MEDIA_TYPES.include?(media_type)
end