← Back to Changelog

v1.6.0

Release

@jaredwray/mockhttp@1.6.0 — 2026-05-16

Flexible URL matching: trailing path segments fall back to the parsable route prefix (fixes #137).

Features

  • ignore trailing path segments after the parsable portion (6f82897, #139)

    A Fastify rewriteUrl hook progressively strips trailing segments when only the static catch-all wildcard or nothing matches. Query strings are preserved and the first path segment is never stripped, so genuinely unknown URLs still 404.

    # Before — only an exact match worked:
    GET /status/429        → 429
    GET /status/429/foo    → 404
    
    # After — trailing segments fall back to the parsable prefix:
    GET /status/429        → 429
    GET /status/429/foo    → 429   (served by /status/:code)
    GET /status/429/foo/bar/ → 429
    GET /status/429?x=1    → 429   (query preserved)
    GET /totally/unknown   → 404   (first segment never stripped)
    

Documentation

  • document flexible URL matching behavior in the README (148ed17, #139)

Internal

  • extract query string before initial route check; add trailing-slash path coverage (5f298ea, #139)
  • fix typos in README and src/swagger.ts (be2b014, #138)

Contributors

  • @jaredwray — #139
  • @mrazauskas — #138 (first contribution 🎉)

Full diff: https://github.com/jaredwray/mockhttp/compare/v1.5.1...v1.6.0