file extensions and vice versa. MIME types can be extended in your application configuration as follows: config :plug, :mimes, %{ "application/vnd.api+json" => ["json-api"] } After adding the configuration, Plug needs to be recompiled. If you are using mix, it can be done with: $ touch deps/plug/mix.exs $ mix deps.compile plug
"POST"}=conn, _opts) do _deserialize(conn) end def call(%Plug.Conn{method: "PUT"}=conn, _opts) do _deserialize(conn) end def call(%Plug.Conn{method: "PATCH"}=conn, _opts) do _deserialize(conn) end def call(conn, _opts), do: conn defp _deserialize(%Plug.Conn{}=conn) do Map.put(conn, :params, _deserialize(conn.params)) end defp _deserialize(%{}=params) do Enum.into(params, %{}, fn({key, value}) -> { _underscore(key), _deserialize(value) } end) end defp _deserialize(value), do: value defp _underscore(key), do: String.replace(key, "-", "_") end
"POST"}=conn, _opts) do _deserialize(conn) end def call(%Plug.Conn{method: "PUT"}=conn, _opts) do _deserialize(conn) end def call(%Plug.Conn{method: "PATCH"}=conn, _opts) do _deserialize(conn) end def call(conn, _opts), do: conn defp _deserialize(%Plug.Conn{}=conn) do Map.put(conn, :params, _deserialize(conn.params)) end defp _deserialize(%{}=params) do Enum.into(params, %{}, fn({key, value}) -> { _underscore(key), _deserialize(value) } end) end defp _deserialize(value), do: value defp _underscore(key), do: String.replace(key, "-", "_") end
"POST"}=conn, _opts) do _deserialize(conn) end def call(%Plug.Conn{method: "PUT"}=conn, _opts) do _deserialize(conn) end def call(%Plug.Conn{method: "PATCH"}=conn, _opts) do _deserialize(conn) end def call(conn, _opts), do: conn defp _deserialize(%Plug.Conn{}=conn) do Map.put(conn, :params, _deserialize(conn.params)) end defp _deserialize(%{}=params) do Enum.into(params, %{}, fn({key, value}) -> { _underscore(key), _deserialize(value) } end) end defp _deserialize(value), do: value defp _underscore(key), do: String.replace(key, "-", "_") end
"POST"}=conn, _opts) do _deserialize(conn) end def call(%Plug.Conn{method: "PUT"}=conn, _opts) do _deserialize(conn) end def call(%Plug.Conn{method: "PATCH"}=conn, _opts) do _deserialize(conn) end def call(conn, _opts), do: conn defp _deserialize(%Plug.Conn{}=conn) do Map.put(conn, :params, _deserialize(conn.params)) end defp _deserialize(%{}=params) do Enum.into(params, %{}, fn({key, value}) -> { _underscore(key), _deserialize(value) } end) end defp _deserialize(value), do: value defp _underscore(key), do: String.replace(key, "-", "_") end
"POST"}=conn, _opts) do _deserialize(conn) end def call(%Plug.Conn{method: "PUT"}=conn, _opts) do _deserialize(conn) end def call(%Plug.Conn{method: "PATCH"}=conn, _opts) do _deserialize(conn) end def call(conn, _opts), do: conn defp _deserialize(%Plug.Conn{}=conn) do Map.put(conn, :params, _deserialize(conn.params)) end defp _deserialize(%{}=params) do Enum.into(params, %{}, fn({key, value}) -> { _underscore(key), _deserialize(value) } end) end defp _deserialize(value), do: value defp _underscore(key), do: String.replace(key, "-", "_") end
"POST"}=conn, _opts) do _deserialize(conn) end def call(%Plug.Conn{method: "PUT"}=conn, _opts) do _deserialize(conn) end def call(%Plug.Conn{method: "PATCH"}=conn, _opts) do _deserialize(conn) end def call(conn, _opts), do: conn defp _deserialize(%Plug.Conn{}=conn) do Map.put(conn, :params, _deserialize(conn.params)) end defp _deserialize(%{}=params) do Enum.into(params, %{}, fn({key, value}) -> { _underscore(key), _deserialize(value) } end) end defp _deserialize(value), do: value defp _underscore(key), do: String.replace(key, "-", "_") end
last_name "Washington" email "[email protected]" date_of_birth Ecto.Date.from_erl({1990,1,1}) password_hash Comeonin.Bcrypt.hashpwsalt("password") end one inherits: valid do id 1 email "[email protected]" first_name "Leroy" last_name "Jenkins" end end test/fixtures/authors.exs