Is turbo stream only rendered response with 200 OK status code?

I tried to sent a page with error message
I could do it with this code

format.turbo_stream do
  render turbo_stream: turbo_stream.prepend("flash", partial: "layouts/flash_messages")
end

but since its error but its have 200 OK status code I feel it as a bad practices so then I add status: :unprocessable_entity

the problem is after I add status: :unprocessable_entity the error message is not rendered
even though I get the response that I want (from inspect element)

format.turbo_stream do
  render turbo_stream: turbo_stream.prepend("flash", partial: "layouts/flash_messages"), status: :unprocessable_entity
end
1 Like