-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
Note static endpoint can return a response object #1961
Conversation
✅ Deploy Preview for astro-docs-2 ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
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.
I’m wondering if we want to document this? I understand supporting it for consistency, but if I understand correctly you can’t use any of the features of Response
really, right? Headers etc. aren’t supported. Are there any circumstances where returning a Response
would be preferable to { body: '...' }
?
Yeah there's not much features you can use with |
I’d like another opinion from @Jutanium or @sarah11918 before I stomp on your PR! 😅 But I definitely think it’s OK to merge the Astro feature without this PR merged yet and we can take a bit more time to decide how best to document this. |
I discovered when first working on this guide that it worked in dev and not build, so thanks @bluwy for fixing that! In terms of docs, I like first introducing the a full-fledged The flip side is that someone might try to use it in SSG mode, notice that it partially works, and then get confused when most of it gets ignored. In the spirit of "don't include code samples that we don't want copied", we could replace the code sample with a note or caution:
I'm also happy to not include it at all. |
Thanks for the comments @Jutanium. I think it sounds better to not document this until we have better support for it. I agree with all the points you mentioned! Closing this one for now. |
What kind of changes does this PR include?
Description
Based on withastro/astro#5258, clarify that you can return a response object from a static endpoint as long as it's a successful response.