るりまサーチ

最速Rubyリファレンスマニュアル検索!
12件ヒット [1-12件を表示] (0.183秒)

別のキーワード

  1. _builtin to_r
  2. open3 pipeline_r
  3. matrix elements_to_r
  4. etc sc_getpw_r_size_max
  5. bigdecimal to_r

ライブラリ

クラス

検索結果

Net::HTTPResponse#value -> nil (24156.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"
r
esponse = Net::HTTP.get_response(URI.parse(uri))
r
esponse.value # => nil
//}

//emlist[例 レ...
...スポンスが 2xx以外][ruby]{
require
'net/http'

uri = "http://www.example.com/invalid.html"
r
esponse = Net::HTTP.get_response(URI.parse(uri))
begin
r
esponse.value
r
escue => e
e.class # => Net::HTTPServerException
e.message # => 404 "Not Found"
end
//}...