るりまサーチ (Ruby 2.5.0)

最速Rubyリファレンスマニュアル検索!
10件ヒット [1-10件を表示] (0.020秒)
トップページ > バージョン:2.5.0[x] > クエリ:Hash[x] > ライブラリ:net/http[x]

別のキーワード

  1. _builtin hash
  2. hash []
  3. dbm to_hash
  4. matrix hash
  5. _builtin to_hash

検索結果

Net::HTTPHeader#type_params -> Hash (358.0)

Content-Type のパラメータを {"charset" => "iso-2022-jp"} という形の Hash で返します。

...返します。

Content-Type: ヘッダフィールドが存在しない場合には
空のハッシュを返します。

//emlist[例][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
res = Net::HTTP.get_response(uri)
res.type_params # => {"charset"=>"UTF-8"}
//}...

Net::HTTPHeader#fetch(key) {|hash| .... } -> String (310.0)

key ヘッダフィールドを返します。

...key が存在する][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.fetch("user-agent") # => "Ruby"
//}

//emlist[例 key のみ指定。key が存在しない][ruby]{
require 'net/http'

begin
req.fetch("content-length...
...efault を指定][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.fetch("content-length", "default") # => "default"
//}

//emlist[例 key とブロックを指定][ruby]{
require 'net/http'

uri = URI.parse('http://www.exa...

Net::HTTPResponse::CODE_CLASS_TO_OBJ -> Hash (310.0)

HTTP レスポンスステータスコードの最初の数字からレスポンスのクラス(分類)を あらわすクラスへのハッシュです。

...HTTP レスポンスステータスコードの最初の数字からレスポンスのクラス(分類)を
あらわすクラスへのハッシュです。

//emlist[][ruby]{
require 'net/http'
Net::HTTPResponse::CODE_CLASS_TO_OBJ['3'] # => Net::HTTPRedirection
//}...

Net::HTTPResponse::CODE_TO_OBJ -> Hash (310.0)

HTTP レスポンスステータスコードから対応するクラスへのハッシュです。

...HTTP レスポンスステータスコードから対応するクラスへのハッシュです。

//emlist[][ruby]{
require 'net/http'
Net::HTTPResponse::CODE_TO_OBJ['404'] # => Net::HTTPNotFound
//}...

Net::HTTP.post_form(uri, params) -> Net::HTTPResponse (25.0)

URI で指定した対象に フォームのデータを HTTP で POST します。

URI で指定した対象に フォームのデータを HTTP で
POST します。

送るデータは params に文字列から文字列への Hash として
渡します。

@param uri POST する対象を URI で指定します。
@param params POST するデータです。

絞り込み条件を変える

Net::HTTPHeader#form_data=(params) (25.0)

HTMLのフォームのデータ params から ヘッダフィールドとボディを設定します。

...][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.form_data = {"q" => ["ruby", "perl"], "lang" => "en"} # => {"q"=>["ruby", "perl"], "lang"=>"en"}
//}

//emlist[例 set_form_data][ruby]{
require 'net/http'

uri = URI.parse...

Net::HTTPHeader#set_form_data(params, sep = '&') -> () (25.0)

HTMLのフォームのデータ params から ヘッダフィールドとボディを設定します。

...][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.form_data = {"q" => ["ruby", "perl"], "lang" => "en"} # => {"q"=>["ruby", "perl"], "lang"=>"en"}
//}

//emlist[例 set_form_data][ruby]{
require 'net/http'

uri = URI.parse...

Net::HTTPRequest.new(path, initheader = nil) -> Net::HTTPRequest (25.0)

HTTP リクエストオブジェクトを生成します。

HTTP リクエストオブジェクトを生成します。

initheader でリクエストヘッダを指定することができます。
{ヘッダフィールド名(文字列)=>その中身(文字列)} という
Hash を用います。

@param path リクエストする path を文字列で与えます。
@param initheader リクエストヘッダをハッシュで指定します。

Net::HTTPHeader#fetch(key) -> String (10.0)

key ヘッダフィールドを返します。

...key が存在する][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.fetch("user-agent") # => "Ruby"
//}

//emlist[例 key のみ指定。key が存在しない][ruby]{
require 'net/http'

begin
req.fetch("content-length...
...efault を指定][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.fetch("content-length", "default") # => "default"
//}

//emlist[例 key とブロックを指定][ruby]{
require 'net/http'

uri = URI.parse('http://www.exa...

Net::HTTPHeader#fetch(key, default) -> String (10.0)

key ヘッダフィールドを返します。

...key が存在する][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.fetch("user-agent") # => "Ruby"
//}

//emlist[例 key のみ指定。key が存在しない][ruby]{
require 'net/http'

begin
req.fetch("content-length...
...efault を指定][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.fetch("content-length", "default") # => "default"
//}

//emlist[例 key とブロックを指定][ruby]{
require 'net/http'

uri = URI.parse('http://www.exa...

絞り込み条件を変える