File: body_stream.rb

package info (click to toggle)
ruby-httparty 0.21.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 908 kB
  • sloc: ruby: 6,782; xml: 425; sh: 35; makefile: 14
file content (14 lines) | stat: -rw-r--r-- 298 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# To upload file to a server use :body_stream

HTTParty.put(
  'http://localhost:3000/train',
  body_stream: File.open('sample_configs/config_train_server_md.yml', 'r')
)


# Actually, it works with any IO object

HTTParty.put(
  'http://localhost:3000/train',
  body_stream: StringIO.new('foo')
)