Skip to content

Document withStringBody() vs auto-render interaction#8315

Merged
dereuromark merged 2 commits into
5.xfrom
5.x-withstringbody-autorender-note
Jun 30, 2026
Merged

Document withStringBody() vs auto-render interaction#8315
dereuromark merged 2 commits into
5.xfrom
5.x-withstringbody-autorender-note

Conversation

@dereuromark

Copy link
Copy Markdown
Member

Resolves the documentation gap raised in cakephp/cakephp#19511.

withStringBody() sets the response body but, by itself, has no visible effect when an action neither returns the response nor disables view rendering. In that case Controller::invokeAction() still calls render() and overwrites the body. This was undocumented and unintuitive.

Adds a warning note to the "Setting the Body" section explaining the two ways to make the string body take effect: return the response, or setResponse() plus disableAutoRender().

@PhantomWatson

Copy link
Copy Markdown
Contributor

Thanks, Mark!

@dereuromark dereuromark merged commit 5c2cc56 into 5.x Jun 30, 2026
6 checks passed
@dereuromark dereuromark deleted the 5.x-withstringbody-autorender-note branch June 30, 2026 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants