def alter_body_by_content_type(body, content_type)
      return body unless body.is_a?(String)
      content_type_attrs = ApiHammer::ContentTypeAttrs.new(content_type)
      if @options[:text].nil? ? content_type_attrs.text? : @options[:text]
        if pretty?
          case content_type_attrs.media_type
          when 'application/json'
            require 'json'
            begin
              body = JSON.pretty_generate(JSON.parse(body))
            rescue JSON::ParserError
            end
          end
        end
        if color?
          coderay_scanner = CodeRayForMediaTypes.reject{|k,v| !v.any?{|type| type === content_type_attrs.media_type} }.keys.first
          if coderay_scanner
            require 'coderay'
            body = CodeRay.scan(body, coderay_scanner).encode(:terminal)
          end
        end
      else
        body = omitted_body("[[omitted binary body (size = #{body.size})]]")
      end
      body
    end
def alter_body_by_content_type(body, content_type)
      return body unless body.is_a?(String)
      content_type_attrs = ApiHammer::ContentTypeAttrs.new(content_type)
      if @options[:text].nil? ? content_type_attrs.text? : @options[:text]
        if pretty?
          case content_type_attrs.media_type
          when 'application/json'
            require 'json'
            begin
              body = JSON.pretty_generate(JSON.parse(body))
            rescue JSON::ParserError
            end
          end
        end
        if color?
          coderay_scanner = CodeRayForMediaTypes.reject{|k,v| !v.any?{|type| type === content_type_attrs.media_type} }.keys.first
          if coderay_scanner
            require 'coderay'
            body = CodeRay.scan(body, coderay_scanner).encode(:terminal)
          end
        end
      else
        body = omitted_body("[[omitted binary body (size = #{body.size})]]")
      end
      body
    end
takes a body and a content type; returns the body, altered according to options.

 - with coloring (ansi colors for terminals) possibly added, if it's a recognized content type and
   #color? is true
 - formatted prettily if #pretty? is true