Packages

Fast. Reusable. Quenya framework helps you generate and build OpenAPIv3 compatible API apps easily from a spec. It greatly reduced the time to build APIs from ideation to production.

Current section

Files

Jump to
quenya lib plugs response_helper.ex
Raw

lib/plugs/response_helper.ex

defmodule Quenya.ResponseHelper do
@moduledoc """
Helper function for response
"""
def encode("application/json", data), do: Jason.encode!(data)
def encode(content_type, _data),
do: raise(Plug.BadRequestError, "Content type #{inspect(content_type)} not supported")
end