3件ヒット
[1-3件を表示]
(0.031秒)
別のキーワード
検索結果
-
Net
:: HTTPResponse # value -> nil (63538.0) -
レスポンスが 2xx(成功)でなかった場合に、対応する 例外を発生させます。
レスポンスが 2xx(成功)でなかった場合に、対応する
例外を発生させます。
@raise HTTPError レスポンスが 1xx であるか、 net/http が知らない
種類のレスポンスである場合に発生します。
@raise HTTPRetriableError レスポンスが 3xx である場合に発生します。
@raise HTTPServerException レスポンスが 4xx である場合に発生します。
@raise HTTPFatalError レスポンスが 5xx である場合に発生します。
//emlist[例 レスポンスが 2xx(成功)... -
net
/ http (19111.0) -
汎用データ転送プロトコル HTTP を扱うライブラリです。 実装は 2616 に基きます。
汎用データ転送プロトコル HTTP を扱うライブラリです。
実装は 2616 に基きます。
=== 使用例
==== ウェブサーバからドキュメントを得る (GET)
//emlist[例1: GET して 表示するだけ][ruby]{
require 'net/http'
print Net::HTTP.get('www.example.com', '/index.html')
//}
//emlist[例2: URI を使う][ruby]{
require 'net/http'
require 'uri'
print Net::HTTP.get(URI.parse('http://w... -
Net
:: HTTPExceptions # response -> Net :: HTTPResponse (9409.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
//}