77件ヒット
[1-77件を表示]
(0.068秒)
別のキーワード
クラス
-
Net
:: HTTPResponse (11)
モジュール
-
Net
:: HTTPExceptions (11) -
Net
:: HTTPHeader (55)
キーワード
-
canonical
_ each (11) - each (11)
-
each
_ capitalized (11) -
each
_ header (11) -
each
_ value (11) - response (11)
検索結果
先頭5件
-
Net
:: HTTPResponse # value -> nil (21116.0) -
レスポンスが 2xx(成功)でなかった場合に、対応する 例外を発生させます。
...ます。
@raise HTTPError レスポンスが 1xx であるか、 net/http が知らない
種類のレスポンスである場合に発生します。
@raise HTTPRetriableError レスポンスが 3xx である場合に発生します。
@raise HTTPServerException レスポンス......します。
@raise HTTPFatalError レスポンスが 5xx である場合に発生します。
//emlist[例 レスポンスが 2xx(成功)][ruby]{
require 'net/http'
uri = "http://www.example.com/index.html"
response = Net::HTTP.get_response(URI.parse(uri))
response.value # => nil
//}
//emlist[......例 レスポンスが 2xx以外][ruby]{
require 'net/http'
uri = "http://www.example.com/invalid.html"
response = Net::HTTP.get_response(URI.parse(uri))
begin
response.value
rescue => e
e.class # => Net::HTTPServerException
e.message # => 404 "Not Found"
end
//}... -
Net
:: HTTPHeader # each _ value {|value| . . . . } -> () (9223.0) -
保持しているヘッダの値をブロックに渡し、呼びだします。
...れる文字列は ", " で連結したものです。
//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.each_value { |value| puts value }
# => gzip;q=1.0,deflate;q=0.6,identity;q=0.3
# => */*
# => Ruby
//}... -
Net
:: HTTPExceptions # response -> Net :: HTTPResponse (6209.0) -
例外の原因となったレスポンスオブジェクトを返します。
...レスポンスオブジェクトを返します。
//emlist[例][ruby]{
require 'net/http'
uri = "http://www.example.com/invalid.html"
response = Net::HTTP.get_response(URI.parse(uri))
begin
response.value
rescue => e
e.response # => #<Net::HTTPNotFound 404 Not Found readbody=true>
end
//}... -
Net
:: HTTPHeader # each _ capitalized {|name , value| . . . . } -> () (6205.0) -
ヘッダフィールドの正規化名とその値のペアを ブロックに渡し、呼びだします。
...ヘッダフィールドの正規化名とその値のペアを
ブロックに渡し、呼びだします。
正規化名は name に対し
name.downcase.split(/-/).capitalize.join('-')
で求まる文字列です。... -
Net
:: HTTPHeader # canonical _ each {|name , value| . . . . } -> () (3105.0) -
ヘッダフィールドの正規化名とその値のペアを ブロックに渡し、呼びだします。
...ヘッダフィールドの正規化名とその値のペアを
ブロックに渡し、呼びだします。
正規化名は name に対し
name.downcase.split(/-/).capitalize.join('-')
で求まる文字列です。... -
Net
:: HTTPHeader # each {|name , val| . . . . } -> () (3015.0) -
保持しているヘッダ名とその値をそれぞれ ブロックに渡して呼びだします。
...//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.each_header { |key,value| puts "#{key} = #{value}" }
# => accept-encoding = gzip;q=1.0,deflate;q=0.6,identity;q=0.3
# => accept = */*
# => user-agent = Ruby... -
Net
:: HTTPHeader # each _ header {|name , val| . . . . } -> () (3015.0) -
保持しているヘッダ名とその値をそれぞれ ブロックに渡して呼びだします。
...//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.each_header { |key,value| puts "#{key} = #{value}" }
# => accept-encoding = gzip;q=1.0,deflate;q=0.6,identity;q=0.3
# => accept = */*
# => user-agent = Ruby...