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

22 lines
430 B
Ruby

# If you are uploading file in params, multipart will used as content-type automatically
HTTParty.post(
'http://localhost:3000/user',
body: {
name: 'Foo Bar',
email: 'example@email.com',
avatar: File.open('/full/path/to/avatar.jpg')
}
)
# However, you can force it yourself
HTTParty.post(
'http://localhost:3000/user',
multipart: true,
body: {
name: 'Foo Bar',
email: 'example@email.com'
}
)