File: body_stream.rb

package info (click to toggle)
ruby-httparty 0.24.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 964 kB
  • sloc: ruby: 7,521; xml: 425; sh: 35; makefile: 14
file content (14 lines) | stat: -rw-r--r-- 298 bytes parent folder | download | duplicates (3)
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')
)