fast-twitch.middlewares.default-charset
Complete generated reference for fast-twitch.middlewares.default-charset
Usage and execution boundary
Adds charset to text/* content types that lack one. It leaves existing charset declarations intact. The second wrapper argument is a charset string, not an options map.
(ns application.middleware
(:require [fast-twitch.middlewares.default-charset :as middleware]))
(defn handler [_]
{:status 200 :headers {"content-type" "text/plain"} :body "Hello"})
(def app (middleware/wrap-default-charset handler "utf-8"))
This defines the Ring handler portion. Adapt app through routing/ft-handler or pass it to server/listen!; startup instructions and a complete walkthrough show the surrounding project.
Wrapper order and all middleware families. The function reference below preserves the upstream signatures and source links; helper functions do not all share the wrapper's arity.
Upstream function reference
Appends a charset parameter to text-based responses that do not already declare one.
default-charset-response
(default-charset-response response request)
(default-charset-response response _request charset)
Function.
Adds a default charset to eligible responses. Source
wrap-default-charset
(wrap-default-charset handler)
(wrap-default-charset handler charset)
Function.
Wraps a handler so text responses receive a fallback charset. Source