要約
Net::HTTPRequest のスーパークラスです。このクラスは直接は使わないでください。
Net::HTTPRequest のサブクラスを使ってください。
目次
- インスタンスメソッド
継承しているメソッド
- Net::HTTPHeaderから継承しているメソッド
- 
  - []
- []=
- add_field
- basic_auth
- canonical_each
- chunked?
- content_length
- content_length=
- content_range
- content_type
- content_type=
- delete
- each
- each_capitalized
- each_capitalized_name
- each_header
- each_key
- each_name
- each_value
- fetch
- form_data=
- get_fields
- key?
- length
- main_type
- proxy_basic_auth
- range
- range=
- range_length
- set_content_type
- set_form_data
- set_range
- size
- sub_type
- type_params
 
インスタンスメソッド
- body -> String[permalink][rdoc][edit]
- 
サーバに送るリクエストのエンティティボディを返します。 例 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= 
- body=(body)[permalink][rdoc][edit]
- 
サーバに送るリクエストのエンティティボディを文字列で設定します。 - [PARAM] body:
- 設定するボディを文字列で与えます。
 例 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" # => "Test Post Data"[SEE_ALSO] Net::HTTPGenericRequest#body 
- body_exist? -> bool[permalink][rdoc][edit]
- 
このメソッドは obsolete です。 
- body_stream -> object[permalink][rdoc][edit]
- body_stream=(f)
- 
サーバに送るリクエストのエンティティボディを IO オブジェクトなどのストリームで設定します。 f は read(size) メソッドが定義されている必要があります。 - [PARAM] f:
- エンティティボディのデータを得るストリームオブジェクトを与えます。
 例 require 'net/http' uri = URI.parse('http://www.example.com/index.html') post = Net::HTTP::Post.new(uri.request_uri) File.open("/path/to/test", 'rb') do |f| # 大きなファイルを扱う際にメモリ消費を少なくできる post.body_stream = f post["Content-Length"] = f.size end post.body_stream # => #<File:/path/to/test (closed)>
- method -> String[permalink][rdoc][edit]
- 
リクエストの 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"
- path -> String[permalink][rdoc][edit]
- 
リクエストする 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"
- request_body_permitted? -> bool[permalink][rdoc][edit]
- 
リクエストにエンティティボディを一緒に送ることが許されている HTTP メソッド (POST など)の場合真を返します。 例 require 'net/http' uri = URI.parse('http://www.example.com/index.html') post = Net::HTTP::Post.new(uri.request_uri) post.request_body_permitted? # => true head = Net::HTTP::Head.new(uri.request_uri) head.request_body_permitted? # => false
- response_body_permitted? -> bool[permalink][rdoc][edit]
- 
サーバからのレスポンスにエンティティボディを含むことが許されている HTTP メソッド (GET, POST など)の場合真を返します。 例 require 'net/http' uri = URI.parse('http://www.example.com/index.html') post = Net::HTTP::Post.new(uri.request_uri) post.response_body_permitted? # => true head = Net::HTTP::Head.new(uri.request_uri) head.response_body_permitted? # => false