Skip to content

basalt / http/src / rawBodyRouteMatcher

Function: rawBodyRouteMatcher() ​

> rawBodyRouteMatcher(routes, options?): (method, path) => boolean

Defined in: http/src/raw-body.ts:134

A predicate telling whether an inbound method + path belongs to one of these routes' rawBody declarations.

Adapters that parse bodies in middleware — before a route is matched — need this to step aside for exactly those paths (Express's express.json({ type }), the Hono plugin's bounded-read middleware). Path parameters (:id) match one segment; a * segment matches one segment and a trailing /* matches the rest. Anything else is compared literally, so an unrecognised pattern under-matches rather than over-matches — the adapter then falls back to its own capture instead of silently leaving a JSON route unparsed.

Parameters ​

routes ​

readonly BasaltRoute[]

options? ​

RawBodyRouteMatcherOptions = {}

Returns ​

(method, path) => boolean

Released under the MIT License.