1
0
Fork 0
mirror of https://github.com/jnunemaker/httparty synced 2023-03-27 23:23:07 -04:00
httparty/examples/body_stream.rb
2018-10-31 07:56:06 +03:00

14 lines
298 B
Ruby

# 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')
)