RespContentTypePlug

A simple Plug to set the content on the response header for all routes.

Installation

The package can be installed by adding resp_content_type_plug to your list of dependencies in mix.exs:

def deps do
  [
    {:resp_content_type_plug, "~> 0.1.0"}
  ]
end

Usage

defmodule MyRouter do
  use Plug.Router
  
  plug RespContentTypePlug, content_type: "application/json"
  plug :match
  plug :dispatch
  
  get "/hello" do
    ...
  end

end