def parse_multipart(boundary, body)
      reader = MultipartParser::Reader.new(boundary)
      result = { errors: [], parts: [] }
      def result.part(name)
        hash = self[:parts].detect { |h| h[:part].name == name }
        [hash[:part], hash[:body].join]
      end

      reader.on_part do |part|
        result[:parts] << thispart = {
          part: part,
          body: []
        }
        part.on_data do |chunk|
          thispart[:body] << chunk
        end
      end
      reader.on_error do |msg|
        result[:errors] << msg
      end
      reader.write(body)
      result
    end
def parse_multipart(boundary, body)
      reader = MultipartParser::Reader.new(boundary)
      result = { errors: [], parts: [] }
      def result.part(name)
        hash = self[:parts].detect { |h| h[:part].name == name }
        [hash[:part], hash[:body].join]
      end

      reader.on_part do |part|
        result[:parts] << thispart = {
          part: part,
          body: []
        }
        part.on_data do |chunk|
          thispart[:body] << chunk
        end
      end
      reader.on_error do |msg|
        result[:errors] << msg
      end
      reader.write(body)
      result
    end
parse a multipart MIME message, returning a hash of any multipart errors