#Cannot set response status in nested components in SSR mode

2 messages · Page 1 of 1 (latest)

lucid tree
#

Hi, I think I found a edge case of an unexpected behavior

Case 1: you have a Component thatn sets Astro.response.status = 500 , using such component directly in one page: HTTP response status gets sent correctly
See example at https://stackblitz.com/edit/github-taw4vz?file=src%2Fpages%2Findex.astro
Loading the result page gives a HTTP 500 status code

Case 2: you have a Wrapper component that envelops the sameComponent : in this case, the Astro.response.status setting gets ignored.
See example at https://stackblitz.com/edit/github-taw4vz-9zgqpj?file=src%2Fpages%2Findex.astro
Pages returns a HTTP 200 despite Component setting the Astro response code

This behavior was discovered while exploring ways to handle Component errors that wouldn't invalidate the whole page rendering

Run official live example code for Astro Minimal, created by Withastro on StackBlitz

magic pineBOT
#
No-one around right now?

It looks like no-one has responded to your question yet. People might not be available right now or don’t know how to answer your question. Want an answer while you wait? Try asking our experimental bot in #1095492539085230272.