-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new fields to API route context #4986
Conversation
🦋 Changeset detectedLatest commit: 4118636 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is blocked because it contains a minor
changeset. A reviewer will merge this at the next release if approved.
Should also have:
|
This is ready for review 👍 Added the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work @bluwy! These are some really great quality-of-life improvements for API routes. Left some suggestions — I may have misunderstood some features so feel free to discard suggestions if they’re not correct.
Co-authored-by: Chris Swithinbank <[email protected]>
Co-authored-by: Chris Swithinbank <[email protected]>
All great suggestions @delucis. Thanks! |
* See withastro/astro#4986 for `site`, `generator`, `url`, `clientAddress`, `props` and `redirect` * See withastro/astro#6721 for `locals` * See withastro/astro#9021 for `preferredLocale` and `preferredLocaleList` * See withastro/astro#9101 for `currentLocale`
* See withastro/astro#4986 for `site`, `generator`, `url`, `clientAddress`, `props` and `redirect` * See withastro/astro#6721 for `locals` * See withastro/astro#9021 for `preferredLocale` and `preferredLocaleList` * See withastro/astro#9101 for `currentLocale`
Changes
Add new
site
,generator
,url
,clientAddress
,props
andredirect
fields to API route context to match closer toAstro
global API.Support second optional parameter
status
forredirect()
(both api and Astro global).Also fixes: #4920
Refactored internally to share types between Astro global too.
Testing
Added a test in ssr-api-routes.
Docs
Docs: withastro/docs#1731
Added links in jsdoc referencing the new docs.