Mojito.post

You're seeing just the function post, go back to Mojito module for more information.
Link to this function

post(url, headers \\ [], payload \\ "", opts \\ [])

View Source

Specs

post(url(), headers(), payload(), Keyword.t()) ::
  {:ok, response()} | {:error, error()} | no_return()

Performs an HTTP POST request and returns the response.

Examples

Submitting a form with POST request:

>>>> Mojito.post(
...>   "http://localhost:4000/messages",
...>   [{"content-type", "application/x-www-form-urlencoded"}],
...>   URI.encode_query(%{"message[subject]" => "Contact request", "message[content]" => "data"}))
{:ok,
%Mojito.Response{
  body: "Thank you!",
  complete: true,
  headers: [
    {"server", "Cowboy"},
    {"connection", "keep-alive"},
    ...
  ],
  status_code: 200
}}

Submitting a JSON payload as POST request body:

>>>> Mojito.post(
...>   "http://localhost:4000/api/messages",
...>   [{"content-type", "application/json"}],
...>   Jason.encode!(%{"message" => %{"subject" => "Contact request", "content" => "data"}}))
{:ok,
%Mojito.Response{
  body: "{\"message\": \"Thank you!\"}",
  complete: true,
  headers: [
    {"server", "Cowboy"},
    {"connection", "keep-alive"},
    ...
  ],
  status_code: 200
}}

See request/1 for detailed documentation.