るりまサーチ

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

別のキーワード

  1. net/http body
  2. httprequest body
  3. net/http read_body
  4. httpresponse body
  5. httpresponse read_body

ライブラリ

クラス

検索結果

Net::HTTPGenericRequest#body_stream=(f) (18107.0)

サーバに送るリクエストのエンティティボディを IO オブジェクトなどのストリームで設定します。 f は read(size) メソッドが定義されている必要があります。

...あります。

@param f エンティティボディのデータを得るストリームオブジェクトを与えます。

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

uri = URI.parse('http://www.example.com/index.html')
p
ost = Net::HTTP::Post.new(uri.request_uri)
File.open("/path/to/test", 'rb') do...
...|f|
# 大きなファイルを扱う際にメモリ消費を少なくできる
p
ost.body_stream = f
p
ost["Content-Length"] = f.size
end
p
ost.body_stream # => #<File:/path/to/test (closed)>
//}...

Net::HTTPGenericRequest#body_stream -> object (3007.0)

サーバに送るリクエストのエンティティボディを IO オブジェクトなどのストリームで設定します。 f は read(size) メソッドが定義されている必要があります。

...あります。

@param f エンティティボディのデータを得るストリームオブジェクトを与えます。

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

uri = URI.parse('http://www.example.com/index.html')
p
ost = Net::HTTP::Post.new(uri.request_uri)
File.open("/path/to/test", 'rb') do...
...|f|
# 大きなファイルを扱う際にメモリ消費を少なくできる
p
ost.body_stream = f
p
ost["Content-Length"] = f.size
end
p
ost.body_stream # => #<File:/path/to/test (closed)>
//}...