Cgi.rb:490:in `+': failed to convert Fixnum into String


(Philip Mak) #1

I was using cgi.rb like this:

cgi.header({‘Status’ => 401, …});

and I got this error:

/usr/local/lib/ruby/1.6/cgi.rb:490:in `+’: failed to convert Fixnum into String (TypeError)

I ended up having to do this:

cgi.header({‘Status’ => ‘401’, …});

Wouldn’t it be more convenient for programmers if cgi.rb accepted any
data type (and converted it to a string)? Maybe on line 490, instead
of this:

buf += key + ": " + value + EOL

do this:

buf += "#{key}: #{value}#{EOL}"

(Wakou Aoyama) #2

snip

I see. ok, change it. Thanks.

···

On Tue, Jul 02, 2002 at 06:45:01AM +0900, Philip Mak wrote:

I was using cgi.rb like this:

cgi.header({‘Status’ => 401, …});

and I got this error:

Wakou Aoyama wakou@ruby-lang.org