From 6d6000cc386b21b94af2f175a6ad6c3b876bb5bf Mon Sep 17 00:00:00 2001 From: Braden Wong <13159333+braden-w@users.noreply.github.com> Date: Fri, 5 Dec 2025 15:39:36 -0800 Subject: [PATCH 1/2] fix: correct quote typos in status examples - Remove extra trailing quote in teapot example - Remove unnecessary escaped apostrophe in double-quoted string --- docs/tutorial/getting-started/status-and-headers/index.md | 2 +- docs/tutorial/patterns/error-handling/index.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/tutorial/getting-started/status-and-headers/index.md b/docs/tutorial/getting-started/status-and-headers/index.md index 923d1e8e..e16313a1 100644 --- a/docs/tutorial/getting-started/status-and-headers/index.md +++ b/docs/tutorial/getting-started/status-and-headers/index.md @@ -49,7 +49,7 @@ You can also return a status code by returning your response using a `status` fu import { Elysia } from 'elysia' new Elysia() - .get('/', ({ status }) => status(418, "I'm a teapot'")) + .get('/', ({ status }) => status(418, "I'm a teapot")) .listen(3000) ``` diff --git a/docs/tutorial/patterns/error-handling/index.md b/docs/tutorial/patterns/error-handling/index.md index 46496ef8..782ff7d0 100644 --- a/docs/tutorial/patterns/error-handling/index.md +++ b/docs/tutorial/patterns/error-handling/index.md @@ -45,7 +45,7 @@ new Elysia() if(code === "NOT_FOUND") return 'uhe~ are you lost?' - return status(418, "My bad! But I\'m cute so you'll forgive me, right?") + return status(418, "My bad! But I'm cute so you'll forgive me, right?") }) .get('/', () => 'ok') .listen(3000) From 78940146742cdeff732a8eebe3cd581c132fd5ac Mon Sep 17 00:00:00 2001 From: Braden Wong <13159333+braden-w@users.noreply.github.com> Date: Fri, 5 Dec 2025 15:40:15 -0800 Subject: [PATCH 2/2] docs(tutorial): clarify status accepts both number and string names Add explanation showing both numeric (418) and string ("I'm a teapot") status names are equivalent, with TypeScript autocompletion support. --- .../tutorial/getting-started/status-and-headers/index.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/tutorial/getting-started/status-and-headers/index.md b/docs/tutorial/getting-started/status-and-headers/index.md index e16313a1..aad10961 100644 --- a/docs/tutorial/getting-started/status-and-headers/index.md +++ b/docs/tutorial/getting-started/status-and-headers/index.md @@ -53,6 +53,15 @@ new Elysia() .listen(3000) ``` +The status code can be a number or a string status name. Both of these are equivalent: + +```typescript +status(418, "I'm a teapot") +status("I'm a teapot", "I'm a teapot") +``` + +String status names provide TypeScript autocompletion for all valid HTTP statuses. + See Status. ## Redirect