Current section

Files

Jump to
digital_ocean lib digital_ocean helpers body.ex
Raw

lib/digital_ocean/helpers/body.ex

defmodule DigitalOcean.Helpers.Body do
@moduledoc false
alias DigitalOcean.{ Config, Operation }
@spec encode!(Operation.t(), Config.t()) :: String.t()
def encode!(%_{ method: method }, _config)
when method == :delete or method == :get do
""
end
def encode!(operation, config) do
operation.params
|> Enum.into(%{})
|> config.json_codec.encode!()
end
end