class WebMock::Response
def assert_valid_body!
def assert_valid_body! valid_types = [Proc, IO, Pathname, String, Array] return if @body.nil? return if valid_types.any? { |c| @body.is_a?(c) } if @body.is_a?(Hash) raise InvalidBody, "must be one of: #{valid_types}, but you've used a #{@body.class}. " \ "Please convert it by calling .to_json .to_xml, or otherwise convert it to a string." else raise InvalidBody, "must be one of: #{valid_types}. '#{@body.class}' given." end end