るりまサーチ

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

別のキーワード

  1. net/http response
  2. response new
  3. http get_response
  4. net/http get_response
  5. imap add_response_handler

ライブラリ

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

Net::IMAP::ResponseError#response=(resp) (33302.0)

エラーとなったレスポンスを表すオブジェクトを設定します。

エラーとなったレスポンスを表すオブジェクトを設定します。

@param resp 設定するレスポンスオブジェクト

Net::HTTPExceptions#response -> Net::HTTPResponse (24432.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::HTTP#close_on_empty_response=(bool) (18308.0)

レスポンスがボディを持っていない場合にコネクションを 閉じるかどうかを設定します。

...ンスがボディを持っていない場合にコネクションを
閉じるかどうかを設定します。


@param bool レスポンスがボディを持っていない場合にコネクションを
閉じるかどうか指定します。

@see Net::HTTP#close_on_empty_response...

Net::HTTPResponse#entity -> String | () | nil (9125.0)

エンティティボディを返します。

...合には nil を返します。

N
et::HTTPResponse#read_body をブロック付きで呼んだ場合には
このメソッドはNet::ReadAdapter のインスタンスを返しますが、
これは使わないでください。

entity は obsolete です。

//emlist[例][ruby]{
require 'net/http'...
...uri = "http://www.example.com/index.html"
response =
Net::HTTP.get_response(URI.parse(uri))
response
.body[0..10] # => "<!doctype h"
//}...

Net::HTTPResponse#http_version -> String (9125.0)

サーバがサポートしている HTTP のバージョンを文字列で返します。

...サーバがサポートしている HTTP のバージョンを文字列で返します。

//emlist[例][ruby]{
require 'net/http'

uri = "http://www.example.com/index.html"
response =
Net::HTTP.get_response(URI.parse(uri))
response
.http_version # => "1.1"
//}...

絞り込み条件を変える

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

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

...スがボディを持たない場合には nil を返します。

//emlist[例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"
//}...
...きいファイルを取得][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/path/to/big.file')
N
et::HTTP.start(uri.host, uri.port) do |http|
File.open("/path/to/big.file", "w") do |f|
# Net::HTTP#request_get と Net::HTTPResponse#read_body で少しずつ読み書き。メ...
...モリ消費が少ない。
http.request_get(uri.path) do |response|
response
.read_body do |s|
f.write(s)
end
end
end
end
//}

一度ブロックを与えずにこのメソッドを呼んだ場合には、
次からはすでに読みだしたボディを文字列とし...

Net::HTTP#send_request(name, path, data = nil, header = nil) -> Net::HTTPResponse (6219.0)

HTTP リクエストをサーバに送り、そのレスポンスを Net::HTTPResponse のインスタンスとして返します。

...HTTP リクエストをサーバに送り、そのレスポンスを
N
et::HTTPResponse のインスタンスとして返します。

@param name リクエストのメソッド名を文字列で与えます。
@param path リクエストのパスを文字列で与えます。
@param data リクエ...
...ストのボディを文字列で与えます。
@param header リクエストのヘッダをハッシュで与えます。

//emlist[例][ruby]{
response =
http.send_request('GET', '/index.html')
puts response.body
//}

@see Net::HTTP#request...

Net::HTTPResponse#value -> nil (6149.0)

レスポンスが 2xx(成功)でなかった場合に、対応する 例外を発生させます。

...ror レスポンスが 1xx であるか、 net/http が知らない
種類のレスポンスである場合に発生します。
@raise HTTPRetriableError レスポンスが 3xx である場合に発生します。
@raise HTTPServerException レスポンスが 4xx である場合に...
...{
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::HTTPResponse#body -> String | () | nil (6125.0)

エンティティボディを返します。

...合には nil を返します。

N
et::HTTPResponse#read_body をブロック付きで呼んだ場合には
このメソッドはNet::ReadAdapter のインスタンスを返しますが、
これは使わないでください。

entity は obsolete です。

//emlist[例][ruby]{
require 'net/http'...
...uri = "http://www.example.com/index.html"
response =
Net::HTTP.get_response(URI.parse(uri))
response
.body[0..10] # => "<!doctype h"
//}...

Net::HTTPResponse#code -> String (6125.0)

HTTP のリザルトコードです。例えば '302' などです。

...スオブジェクトがどのクラスのインスタンスかを
見ることでもレスポンスの種類を判別できます。

//emlist[例][ruby]{
require 'net/http'

uri = "http://www.example.com/index.html"
response =
Net::HTTP.get_response(URI.parse(uri))
response
.code # => "200"
//}...

絞り込み条件を変える

<< 1 2 3 ... > >>