Changeset 29275

Show
Ignore:
Timestamp:
01/30/09 13:55:41 (4 years ago)
Author:
isaisstillalive
Message:
  • パラメータが空の場合に落ちてたので処理を追加(未テスト)
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/ruby/hatena/api_branch/haiku.rb

    r29272 r29275  
    265265          uri = URI.parse(uri) 
    266266          Net::HTTP.start(uri.host) do |http| 
    267             if options[:params][:file] 
     267            if options[:params] && options[:params][:file] 
    268268              boundary = "--------------------" + Time.now.to_f.to_s.tr('.', '') 
    269269              header = { 
     
    272272              body = build_form_data( 
    273273                boundary, 
    274                 options[:params] || {} 
     274                options[:params] 
    275275              ) 
    276276            else 
    277               body = options[:params].map{|k,v| "#{k}=#{URI.encode v.to_s}" }.join("&") 
     277              if options[:params] 
     278                body = options[:params].map{|k,v| "#{k}=#{URI.encode v.to_s}" }.join("&") 
     279              else 
     280                body = "" 
     281              end 
    278282              header = { 
    279283                'Content-Length' => body.bytesize.to_s