るりまサーチ

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

別のキーワード

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

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

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

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

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

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

Net::HTTP#close_on_empty_response=(bool) (6100.0)

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

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


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

@see Net::HTTP#close_on_empty_response

Net::HTTP#head(path, header = nil) -> Net::HTTPResponse (12.0)

サーバ上の path にあるエンティティのヘッダのみを取得します。 Net::HTTPResponse のインスタンスを返します。

...

1.1 互換モードの場合は、レスポンスに応じて例外が発生します。

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

response =
nil
Net::HTTP.start('some.www.server', 80) {|http|
response =
http.head('/index.html')
}
p response['content-type']
//}

@see Net::HTTP#request_head...

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

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

...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...

net/http (12.0)

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

...re 'uri'

def fetch(uri_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...
...re 'net/http'

Net::HTTP.start('www.example.com') {|http|
req = Net::HTTP::Get.new('/secret-page.html')
req.basic_auth 'account', 'password'
response =
http.request(req)
print response.body
}
//}





=== フォームの値の区切り文字について

POSTで application/x-www-form-urlenc...

絞り込み条件を変える

Data.define(*args) -> Class (6.0)

Data クラスに新しいサブクラスを作って、それを返します。

...ブクラスも定義可能です。
以下のように、パターンマッチに利用できます。

//emlist[例][ruby]{
class HTTPFetcher
Response =
Data.define(:body)
NotFound = Data.define

def get(url)
# ダミーの実装
if url == "http://example.com/"
Response.new(bod...

Data.define(*args) {|subclass| block } -> Class (6.0)

Data クラスに新しいサブクラスを作って、それを返します。

...ブクラスも定義可能です。
以下のように、パターンマッチに利用できます。

//emlist[例][ruby]{
class HTTPFetcher
Response =
Data.define(:body)
NotFound = Data.define

def get(url)
# ダミーの実装
if url == "http://example.com/"
Response.new(bod...

Net::HTTP#get(path, header = nil, dest = nil) -> Net::HTTPResponse (6.0)

サーバ上の path にあるエンティティを取得し、 Net::HTTPResponse のインスタンスとして返します。

...のボディ] となります。

//emlist[例][ruby]{
# net/http version 1.1
response, body = http.get( '/index.html' )

# net/http version 1.2
response =
http.get('/index.html')

# compatible in both version
response , = http.get('/index.html')
response.body

# compatible, using block
File.open('s...

Net::HTTP#get(path, header = nil, dest = nil) {|body_segment| .... } -> Net::HTTPResponse (6.0)

サーバ上の path にあるエンティティを取得し、 Net::HTTPResponse のインスタンスとして返します。

...のボディ] となります。

//emlist[例][ruby]{
# net/http version 1.1
response, body = http.get( '/index.html' )

# net/http version 1.2
response =
http.get('/index.html')

# compatible in both version
response , = http.get('/index.html')
response.body

# compatible, using block
File.open('s...

Net::HTTP#get2(path, header = nil) -> Net::HTTPResponse (6.0)

サーバ上の path にあるエンティティを取得します。 Net::HTTPResponse オブジェクトを返します。

...字列で指定します。
@param header リクエストの HTTP ヘッダをハッシュで指定します。

//emlist[例][ruby]{
# example
response =
http.request_get('/index.html')
p response['content-type']
puts response.body # body is already read

# using block
http.request_get('/i...

絞り込み条件を変える

<< 1 2 3 ... > >>