Ruby 2.7.0 リファレンスマニュアル > ライブラリ一覧 > net/httpライブラリ > Net::HTTPGenericRequestクラス > path

instance method Net::HTTPGenericRequest#path

path -> String[permalink][rdoc]

リクエストする path を文字列で返します。



require 'net/http'

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