るりまサーチ

最速Rubyリファレンスマニュアル検索!
101件ヒット [1-100件を表示] (0.046秒)
トップページ > クエリ:@[x] > クエリ:get_response[x]

別のキーワード

  1. tracer set_get_line_procs
  2. webrick/httpservlet do_get
  3. net/http get
  4. http get
  5. http get_response

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 > >>

Net::HTTP.get_response(host, path = nil, port = nil) -> Net::HTTPResponse (18132.0)

指定した対象に GET リクエストを送り、そのレスポンスを Net::HTTPResponse として返します。

...かです。

@
param uri データの取得対象を URI で指定します。
@
param host 接続先のホストを文字列で指定します。
@
param path データの存在するパスを文字列で指定します。
@
param port 接続するポートを整数で指定します。
@
see Net::HTTP...

Net::HTTP.get_response(uri) -> Net::HTTPResponse (18132.0)

指定した対象に GET リクエストを送り、そのレスポンスを Net::HTTPResponse として返します。

...かです。

@
param uri データの取得対象を URI で指定します。
@
param host 接続先のホストを文字列で指定します。
@
param path データの存在するパスを文字列で指定します。
@
param port 接続するポートを整数で指定します。
@
see Net::HTTP...

Net::HTTPResponse#value -> nil (36.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
//}...

NEWS for Ruby 3.0.0 (18.0)

NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...rue` is used. 17104
* Magic comment `shareable_constant_value` added to freeze constants.
See {Magic Comments}[rdoc-ref:doc/syntax/comments.rdoc@Magic+Comments] for more details.
17273
* A {static analysis}[rdoc-label:label-Static+analysis] foundation is
introduced.
* {RBS}[rdo...
...* 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...
...on uses only methods ending with `!`.
* Ractor compatible.
* Improved support for YAML. 8382
* Use officially discouraged. Read OpenStruct@Caveats section.
* Pathname
* Ractor compatible.
* Psych
* Update to Psych 3.3.0
* This version is Ractor compatible.
* Reline...

Net::HTTPHeader#get_fields(key) -> [String] (18.0)

key ヘッダフィールドの値 (文字列) を配列で返します。

...を区別しません。

@
param 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#[] , Ne...

絞り込み条件を変える

Net::HTTPResponse#read_body {|str| .... } -> () (18.0)

ブロックを与えなかった場合にはエンティティボディを 文字列で返します。 ブロックを与えた場合には エンティティボディを少しずつ取得して順次ブロックに 文字列で与えます。

...1 ブロックを与えずに一度に結果取得][ruby]{
require 'net/http'

uri = "http://www.example.com/index.html"
response = Net::HTTP.get_response(URI.parse(uri))
response.read_body[0..10] # => "<!doctype h"
//}

//emlist[例2 ブロックを与えて大きいファイルを取得][ruby]{
re...
...い。

dest は obsolete です。使わないでください。
dest を指定した場合には
ボディを少しずつ取得して順次
「dest << ボディの断片」を実行します。

@
param dest obsoleteな引数です。利用しないでください。

@
see Net::HTTP#request_get...

Net::HTTPResponse#read_body(dest=nil) -> String|nil (18.0)

ブロックを与えなかった場合にはエンティティボディを 文字列で返します。 ブロックを与えた場合には エンティティボディを少しずつ取得して順次ブロックに 文字列で与えます。

...1 ブロックを与えずに一度に結果取得][ruby]{
require 'net/http'

uri = "http://www.example.com/index.html"
response = Net::HTTP.get_response(URI.parse(uri))
response.read_body[0..10] # => "<!doctype h"
//}

//emlist[例2 ブロックを与えて大きいファイルを取得][ruby]{
re...
...い。

dest は obsolete です。使わないでください。
dest を指定した場合には
ボディを少しずつ取得して順次
「dest << ボディの断片」を実行します。

@
param dest obsoleteな引数です。利用しないでください。

@
see Net::HTTP#request_get...

Net::HTTPHeader#key?(key) -> bool (12.0)

key というヘッダフィールドがあれば真を返します。 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.k...

net/http (12.0)

汎用データ転送プロトコル HTTP を扱うライブラリです。 実装は 2616 に基きます。

...{'q'=>'ruby', 'max'=>'50'})
puts res.body

#例2: 認証付きで POST する
res = Net::HTTP.post_form(URI.parse('http://jack:pass@www.example.com/todo.cgi'),
{'from'=>'2005-01-01', 'to'=>'2005-03-31'})
puts res.body

#例3: より細かく制御する
u...
...str, limit = 10)
# You should choose better exception.
raise ArgumentError, 'HTTP redirect too deep' if limit == 0

response = Net::HTTP.get_response(URI.parse(uri_str))
case response
when Net::HTTPSuccess
response
when Net::HTTPRedirection
fetch(response['location'], limit - 1)...
<< 1 2 > >>