PhoenixApiToolkit.TestHelpers.create_hmac_plug_body
You're seeing just the function
create_hmac_plug_body
, go back to PhoenixApiToolkit.TestHelpers module for more information.
Link to this function
create_hmac_plug_body(path, method, contents \\ %{}, timestamp \\ DateTime.utc_now() |> DateTime.to_unix(:second))
View SourceSpecs
Generate a request body for an endpoint secured with PhoenixApiToolkit.Security.HmacPlug
.
Use put_hmac/3
to generate a valid signature.
It is possible to override the timestamp set in the request body. The default generates a valid request body, so overrides are not necessary unless you wish to test the HMAC verification itself.
Examples
iex> create_hmac_plug_body("/hello", "GET", %{hello: "world"}, 12345) |> Jason.decode!()
%{
"contents" => %{"hello" => "world"},
"method" => "GET",
"path" => "/hello",
"timestamp" => 12345
}