module Kiev::RequestBodyFilter

Constants

FILTERED
FORM_DATA_CONTENT_TYPES
JSON_CONTENT_TYPE
XML_CONTENT_TYPES

Public Class Methods

filter(content_type, request_body, filtered_params, ignored_params) click to toggle source
# File lib/kiev/request_body_filter.rb, line 29
def self.filter(content_type, request_body, filtered_params, ignored_params)
  body = request_body.read
  request_body.rewind
  body_filter = for_content_type(content_type)
  body_filter.call(body, filtered_params, ignored_params)
end
for_content_type(content_type) click to toggle source
# File lib/kiev/request_body_filter.rb, line 16
def self.for_content_type(content_type)
  case content_type
  when *JSON_CONTENT_TYPE
    Json
  when *XML_CONTENT_TYPES
    Xml
  when *FORM_DATA_CONTENT_TYPES
    FormData
  else
    Default
  end
end