analytics / lib /plausible_web /plugs /internal_stats_api_version.ex
Leon4gr45's picture
Upload folder using huggingface_hub (part 3)
88211d3 verified
Raw
History Blame Contribute Delete
503 Bytes
defmodule PlausibleWeb.Plugs.InternalStatsApiVersion do
@moduledoc """
Adds the `x-api-version` response header to all internal
stats API responses. See `Plausible.InternalStatsApiVersion`
for version tracking and rollout logic.
"""
@behaviour Plug
import Plug.Conn
@impl true
def init(opts), do: opts
@impl true
def call(conn, _opts) do
version = Plausible.InternalStatsApiVersion.effective_version()
put_resp_header(conn, "x-api-version", to_string(version))
end
end