るりまサーチ

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

別のキーワード

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

ライブラリ

モジュール

キーワード

検索結果

<< < 1 2 3 4 > >>

Net::HTTP#request_head(path, header = nil) -> Net::HTTPResponse (7.0)

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

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


head2 は時代遅れなので使わないでください。

//emlist[例][ruby]{
response =
http.request_head('/index.html')
p response['content-type']
//}

@see Net::HTTP#head...

Net::HTTP#request_head(path, header = nil) {|response| .... } -> Net::HTTPResponse (7.0)

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

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


head2 は時代遅れなので使わないでください。

//emlist[例][ruby]{
response =
http.request_head('/index.html')
p response['content-type']
//}

@see Net::HTTP#head...

Net::HTTP#request_post(path, data, header = nil) -> Net::HTTPResponse (7.0)

サーバ上の path にあるエンティティに対し文字列 data を POST で送ります。 返り値は Net::HTTPResponse のインスタンスです。

...ストの HTTP ヘッダをハッシュで指定します。

post2 は時代遅れなので使わないでください。

//emlist[例][ruby]{
response =
http.request_post('/cgi-bin/nice.rb', 'datadatadata...')
p response.status
puts response.body # body is already read

# using block
htt...

Net::HTTP#request_post(path, data, header = nil) {|response| .... } -> Net::HTTPResponse (7.0)

サーバ上の path にあるエンティティに対し文字列 data を POST で送ります。 返り値は Net::HTTPResponse のインスタンスです。

...ストの HTTP ヘッダをハッシュで指定します。

post2 は時代遅れなので使わないでください。

//emlist[例][ruby]{
response =
http.request_post('/cgi-bin/nice.rb', 'datadatadata...')
p response.status
puts response.body # body is already read

# using block
htt...

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

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

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

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

@see Net::HTTP#request...

絞り込み条件を変える

Net::HTTPExceptions#response -> Net::HTTPResponse (7.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::HTTPResponse#body -> String | () | nil (7.0)

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

...dapter のインスタンスを返しますが、
これは使わないでください。

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 (7.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"
//}...

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

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

...dapter のインスタンスを返しますが、
これは使わないでください。

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"
//}...
<< < 1 2 3 4 > >>