Skip to content
\n

I could probably just inspect mojo.respond or mojo.finished and make the decision based on that, but neither of them is documented which makes me want to avoid them:

\n
$ git grep mojo.respond\nlib/Mojolicious/Renderer.pm:  croak 'A response has already been rendered' if $c->stash->{'mojo.respond'}++;\n$ git grep mojo.finished\nlib/Mojolicious/Controller.pm:  if (!$stash->{'mojo.finished'} && ++$stash->{'mojo.finished'}) {\n$\n
\n

I assume they're both for internal use only and I'm not supposed to access them directly in application code?
\nPerhaps there's some \"proper\" way to do what I want?

","upvoteCount":1,"answerCount":2,"acceptedAnswer":{"@type":"Answer","text":"

The safe thing to do is to see if the $c->res has a code

","upvoteCount":3,"url":"https://github.com/mojolicious/mojo/discussions/2188#discussioncomment-9872088"}}}

How do I know if response has already been rendered? #2188

Discussion options

You must be logged in to vote

The safe thing to do is to see if the $c->res has a code

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@please-fill-out-this-field
Comment options

Answer selected by please-fill-out-this-field
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants