class WebMock::BodyPattern

def body_as_hash(body, content_type)

def body_as_hash(body, content_type)
  case body_format(content_type)
  when :json then
    WebMock::Util::Parsers::JSON.parse(body)
  when :xml then
    WebMock::Util::Parsers::XML.parse(body)
  else
    WebMock::Util::QueryMapper.query_to_values(body, notation: Config.instance.query_values_notation)
  end
rescue WebMock::Util::Parsers::ParseError
  nil
end