Skip to content

Commit 7894014

Browse files
committed
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.
1 parent 6d6000c commit 7894014

File tree

1 file changed

+9
-0
lines changed
  • docs/tutorial/getting-started/status-and-headers

1 file changed

+9
-0
lines changed

docs/tutorial/getting-started/status-and-headers/index.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@ new Elysia()
5353
.listen(3000)
5454
```
5555

56+
The status code can be a number or a string status name. Both of these are equivalent:
57+
58+
```typescript
59+
status(418, "I'm a teapot")
60+
status("I'm a teapot", "I'm a teapot")
61+
```
62+
63+
String status names provide TypeScript autocompletion for all valid HTTP statuses.
64+
5665
See <DocLink href="/essential/handler#status">Status</DocLink>.
5766

5867
## Redirect

0 commit comments

Comments
 (0)