def collect_responses(headers, &block)
      responses = super(headers, &block)

      html_part, text_part = detect_parts(responses)
      if html_part && !text_part
        text_body = generate_text_body(html_part[:body])
        responses.insert 0, { content_type: "text/plain", body: text_body }
      end

      responses
    end
def collect_responses(headers, &block)
      responses = super(headers, &block)

      html_part, text_part = detect_parts(responses)
      if html_part && !text_part
        text_body = generate_text_body(html_part[:body])
        responses.insert 0, { content_type: "text/plain", body: text_body }
      end

      responses
    end
Rails 4