Skip to main content

Request.with_json

with_jsonjson_body

Documentation

Set the body text in the request encoded as "application/json".

Arguments

  • json_body: The body to add to the request. It must be textual JSON.

Examples

Setting the body in a post request to some JSON.

     import Standard.Base.Network.HTTP.Request.Request
import Standard.Base.Network.HTTP.Request_Body.Request_Body
import Standard.Base.Network.URI.URI

example_with_json =
Request.post (URI.parse "http://example.com") Request_Body.Empty |> _.with_json '{ "a": "b" }'