Skip to content

BeechCMS


BeechCMS / @beechcms/core / matchOperation

Function: matchOperation() ​

matchOperation(method, path): OperationSpec | null

Finds the catalogued operation a request addresses.

Parameters ​

method ​

string

Upper-case HTTP method; anything outside GET|POST|PUT|PATCH|DELETE misses.

path ​

string

Request pathname (c.req.path), without query string. One trailing slash is ignored.

Returns ​

OperationSpec | null

The most specific matching operation (literal segments beat parameters), or null on any miss. Fail-closed: a miss is never upgraded to a guess. Never throws.