API reference

fast-twitch.middlewares.request-size-limit

Complete generated reference for fast-twitch.middlewares.request-size-limit

Usage and execution boundary

Checks declared Content-Length, not actual streamed byte count. Missing length does not trigger the declared-size rejection. Pair it with a bounded reader when the application needs a real consumption bound.

(ns application.middleware
  (:require [fast-twitch.middlewares.request-size-limit :as middleware]))

(defn handler [_]
  {:status 200 :headers {"content-type" "text/plain"} :body "Hello"})

(def app (middleware/wrap-request-size-limit handler {:max-bytes 65536}))

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.

Settings and defaults

Setting Meaning
:max-bytes Limit, also accepted as numeric wrapper option
:error-response Default 413 Content Too Large
:error-handler Function [request] overriding the error response

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

Rejects requests whose declared body size exceeds a configured limit.

content-length

(content-length request)

Function.

Returns the request Content-Length header as a number when it can be parsed. Source

default-error-response

The default response returned when a request body is too large. Source

request-size-limit-response

(request-size-limit-response request options)

Function.

Builds the response returned for an oversized request. Source

request-too-large?

(request-too-large? request max-bytes)

Function.

Returns true when the request declares a body larger than max-bytes. Source

wrap-request-size-limit

(wrap-request-size-limit handler)
(wrap-request-size-limit handler options)

Function.

Wraps a handler with Content-Length based request size enforcement. Source


Source revision a4eb73f96836d034c7a24fe09dc7d51e4c581f64

Built with Fast-Twitch · Integrant · Datastar

Search documentation

Search pages and API symbols

Start hereWelcome to Fast-TwitchRing HTTP applications and configured native clients and transports in ClojureScript.Start hereGetting startedCompile and run your first Fast-Twitch server.Core conceptsRequest & responseUnderstand the maps at the center of a Fast-Twitch application.Core conceptsRoutingMatch URL patterns and compose handlers.Core conceptsMiddlewareWrap handlers with focused request and response behavior.GuidesHTML & IntegrantCompose a UI system with Integrant and render Hiccup.