Last 12 weeks ยท 97 commits
5 of 6 standards met
Summary Add a new middleware that returns with an header when a request matches a registered route path but the HTTP method is not supported. This implements the approach proposed by @usualoma in #4633 (comment) and confirmed by @yusukebe (comment). Closes #4633 Usage Implementation Details Takes the instance as an argument (same pattern as ) Lazily builds an internal from on first 404 encounter Checks if the request path matches any registered route with a different method Throws with header listing valid methods (per RFC 7231) Skips routes registered with / () when collecting methods Deduplicates methods in the header Tests (16 passing) Checklist [x] Tests pass: 16/16 [x] 100% code coverage (statements, branches, functions, lines) [x] TypeScript: โ zero errors [x] Formatting: โ no changes needed [x] Linting: โ zero warnings [x] Export entries added to (exports + typesVersions) and [x] Export validation: passes
Summary Fixes #4789 When using , a `hrefdeDupeKeyMaplink["href"]src/jsx/intrinsic-element/common.tsrelhreflangsrc/jsx/intrinsic-element/components.tssrc/jsx/dom/intrinsic-element/components.tsmeta['name', 'httpEquiv', 'charset', 'itemProp']namenullscript['src']style['data-href']title[]rel="canonical"rel="alternate"hreflang="en"hreflang="ja"rel="stylesheet"` (same href) Closes #4789
Repository: honojs/hono. Description: Web framework built on Web Standards Stars: 29185, Forks: 965. Primary language: TypeScript. Languages: TypeScript (99.4%), JavaScript (0.6%), Dockerfile (0%), HTML (0%). License: MIT. Homepage: https://hono.dev Topics: aws-lambda, bun, cloudflare, cloudflare-workers, deno, npm, router, typescript, web-framework. Latest release: v4.12.5 (1d ago). Open PRs: 90, open issues: 262. Last activity: 6h ago. Community health: 75%. Top contributors: yusukebe, usualoma, EdamAme-x, watany-dev, ryuapp, nakasyou, metrue, exoego, sor4chi, yasuaki640 and others.
TypeScript
PR https://github.com/honojs/hono/pull/4393 improved the ability to get accurate types for specific status codes. While this is a great improvement on its own, it is causing an issue in my project. In my project, we centrally manage 4xx and 5xx errors using a customized fetch function. Our design allows individual UI components to handle only the success cases. Previously, this meant our UI components were type-safe without needing to explicitly check the response code. However, since v4.10.0 (where https://github.com/honojs/hono/pull/4393 was released), we can no longer resolve the types without checking status or ok in each UI component. As a result, we are forced to add these checks to every single API call site. This negatively affects the codebase by reducing readability (due to increased boilerplate) and increasing the bundle size. Is there a way to maintain type safety without manually checking status or code, just as we were able to do before? Any advice would be appreciated. _Originally posted by @baseballyama in https://github.com/honojs/hono/discussions/4575_