Skip to content
instance method

Net::HTTPGenericRequest#body=

(::String? body) -> ::String?
body=(str)

Sets the body for the request:

Example
req = Net::HTTP::Post.new(uri)
req.body # => nil
req.body = '{"title": "foo","body": "bar","userId": 1}'
req.body # => "{\"title\": \"foo\",\"body\": \"bar\",\"userId\": 1}"
See also #body_stream= #inspect also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0