docs: add JSDoc for status() documenting string and number arguments#1602
docs: add JSDoc for status() documenting string and number arguments#1602braden-w wants to merge 2 commits intoelysiajs:mainfrom
Conversation
|
Warning Rate limit exceeded@braden-w has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 20 minutes and 59 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
WalkthroughA new Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Document that numeric codes in emptyHttpStatus (101, 204, 205, 304, 307, 308)
always omit the response body, while string status names bypass this check.
Update examples to show:
- status(204) yields undefined (no body)
- status("No Content") yields "No Content" string body
- status(404) defaults to "Not Found" body
This adds JSDoc documentation to the
status()function insrc/error.tswith examples showing both usage patterns: numeric codes (like418) and string status names (like"I'm a teapot"). The string syntax provides TypeScript autocompletion for all valid HTTP status names, which is a nice DX improvement worth surfacing to developers.Summary by CodeRabbit
status()helper function for creating status responses with flexible input options (numeric or named codes), automatic type inference, and enhanced autocompletion support.✏️ Tip: You can customize this high-level summary in your review settings.