lib/packetgen/header/http/request.rb in packetgen-2.4.0 vs lib/packetgen/header/http/request.rb in packetgen-2.5.0

- old
+ new

@@ -1,10 +1,12 @@ # This file is part of PacketGen # See https://github.com/sdaubert/packetgen for more informations # Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net> # This program is published under MIT license. +# frozen_string_literal: true + module PacketGen module Header module HTTP # An HTTP/1.1 Request packet consits of: # * the http method ({Types::String}). @@ -74,10 +76,10 @@ # @return [String] def to_s raise FormatError, "Missing #method." if self.method.empty? raise FormatError, "Missing #path." if self.path.empty? raise FormatError, "Missing #version." if self.version.empty? - str = "" # build 'dat string + str = "".dup # build 'dat string str << self[:method] << " " << self[:path] << " " << self[:version] << "\r\n" << self[:headers].to_s end end end