別のキーワード
種類
- インスタンスメソッド (165)
- 特異メソッド (22)
- 文書 (15)
- ライブラリ (11)
ライブラリ
-
net
/ http (187)
クラス
-
Net
:: HTTP (22) -
Net
:: HTTPResponse (99)
モジュール
-
Net
:: HTTPExceptions (11) -
Net
:: HTTPHeader (55)
キーワード
-
NEWS for Ruby 3
. 0 . 0 (4) - body (11)
- code (11)
- entity (11)
-
get
_ fields (11) -
http
_ version (11) - key? (11)
-
main
_ type (11) - msg (11)
-
net
/ http (11) -
read
_ body (22) - response (11)
-
sub
_ type (11) -
type
_ params (11) - value (11)
- 制御構造 (11)
検索結果
先頭5件
-
Net
:: HTTP . get _ response(host , path = nil , port = nil) -> Net :: HTTPResponse (18202.0) -
指定した対象に GET リクエストを送り、そのレスポンスを Net::HTTPResponse として返します。
指定した対象に GET リクエストを送り、そのレスポンスを
Net::HTTPResponse として返します。
対象の指定方法は URI で指定するか、
(host, path, port) で指定するかのいずれかです。
@param uri データの取得対象を URI で指定します。
@param host 接続先のホストを文字列で指定します。
@param path データの存在するパスを文字列で指定します。
@param port 接続するポートを整数で指定します。
@see Net::HTTP#get -
Net
:: HTTP . get _ response(uri) -> Net :: HTTPResponse (18202.0) -
指定した対象に GET リクエストを送り、そのレスポンスを Net::HTTPResponse として返します。
指定した対象に GET リクエストを送り、そのレスポンスを
Net::HTTPResponse として返します。
対象の指定方法は URI で指定するか、
(host, path, port) で指定するかのいずれかです。
@param uri データの取得対象を URI で指定します。
@param host 接続先のホストを文字列で指定します。
@param path データの存在するパスを文字列で指定します。
@param port 接続するポートを整数で指定します。
@see Net::HTTP#get -
NEWS for Ruby 3
. 0 . 0 (300.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...mlist{
def method_missing(meth, ...)
send(:"do_#{meth}", ...)
end
//}
* Pattern matching (`case/in`) is no longer experimental. 17260
* One-line pattern matching is redesigned. [EXPERIMENTAL]
* `=>` is added. It can be used like a rightward assignment.
17260
* `in......> 0
{b: 0, c: 1} => {b:}
p b #=> 0
//}
//emlist{
# version 3.0
0 in 1 #=> false
# version 2.7
0 in 1 #=> raise NoMatchingPatternError
//}
* Find-pattern is added. [EXPERIMENTAL]
16828
//emlist{
case ["a", 1, "b", "c", 2, "d", "e", "f", 3]
in [*pre, String => x, String => y, *post]
p pr......* Net::HTTP#verify_hostname= and Net::HTTP#verify_hostname have been added to skip hostname verification. 16555
* Net::HTTP.get, Net::HTTP.get_response, and Net::HTTP.get_print can take the request headers as a Hash in the second argument when the first argument is a URI. 16686
* Net::SMTP... -
Net
:: HTTPHeader # type _ params -> Hash (166.0) -
Content-Type のパラメータを {"charset" => "iso-2022-jp"} という形の Hash で返します。
...Content-Type のパラメータを {"charset" => "iso-2022-jp"}
という形の Hash で返します。
Content-Type: ヘッダフィールドが存在しない場合には
空のハッシュを返します。
//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.h......tml')
res = Net::HTTP.get_response(uri)
res.type_params # => {"charset"=>"UTF-8"}
//}... -
Net
:: HTTPHeader # get _ fields(key) -> [String] (118.0) -
key ヘッダフィールドの値 (文字列) を配列で返します。
...key ヘッダフィールドの値 (文字列) を配列で返します。
たとえばキー 'content-length' に対しては ['2048'] のような
文字列が得られます。一種類のヘッダフィールドが一つのヘッダの中
に複数存在することがありえます。
key は......ール名を文字列で与えます。
//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
res = Net::HTTP.get_response(uri)
res.get_fields('accept-ranges') # => ["none"]
//}
@see Net::HTTPHeader#[] , Net::HTTPHeader#[]=,
Net::HTTPHeader#add_field... -
Net
:: HTTPHeader # key?(key) -> bool (118.0) -
key というヘッダフィールドがあれば真を返します。 key は大文字小文字を区別しません。
...せん。
@param key 探すヘッダフィールド名を文字列で与えます。
//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
res = Net::HTTP.get_response(uri)
res.key?('content-type') # => true
res.key?('nonexist-header') # => false
//}... -
Net
:: HTTPHeader # main _ type -> String|nil (112.0) -
"text/html" における "text" のようなタイプを表す 文字列を返します。
...タイプを表す
文字列を返します。
Content-Type: ヘッダフィールドが存在しない場合には nil を返します。
//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
res = Net::HTTP.get_response(uri)
res.main_type # => "text"
//}... -
Net
:: HTTPHeader # sub _ type -> String|nil (112.0) -
"text/html" における "html" のようなサブタイプを表す 文字列を返します。
...タイプを表す
文字列を返します。
Content-Type: ヘッダフィールドが存在しない場合には nil を返します。
//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
res = Net::HTTP.get_response(uri)
res.sub_type # => "html"
//}... -
Net
:: HTTPResponse # value -> nil (112.0) -
レスポンスが 2xx(成功)でなかった場合に、対応する 例外を発生させます。
...ww.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... -
Net
:: HTTPExceptions # response -> Net :: HTTPResponse (106.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
//}...