instance method Net::HTTPGenericRequest#method

method -> String[permalink][rdoc]

リクエストの HTTP メソッドを文字列で返します。



require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Post.new(uri.request_uri)
req.method # => "POST"
req = Net::HTTP::Get.new(uri.request_uri)
req.method # => "GET"