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

instance method Net::HTTPGenericRequest#body

body -> String[permalink][rdoc]

サーバに送るリクエストのエンティティボディを返します。



require 'net/http'

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

[SEE_ALSO] Net::HTTPGenericRequest#body=