Response::send() in 4.x?

Hii there,

I just noticed that in 4.x, the Cake\Http\Response::send() method got removed (somehow, I never got any deprecation errors about it).
This breaks an entire component I have build and my app relies on pretty heavily for the GraphQL API.
My question is how I can replace this method and send the response I’ve build immediately.

May not be the “cake way”, but it works:

$responseEmitter = new \Cake\Http\ResponseEmitter();
$responseEmitter->emit($response);

Why do you need to send response? Just return the response instance and let the regular request flow continue.

Because somehow it can’t.
When I try to return the response instance, it just completely ignores any changes I’ve made to it.

Are you remembering that the response instance is not mutable? You need to do $response = $response->blah(), not just $response->blah().

Oh, no, I thought it was mutable…
I’ll fix it tonight :slight_smile:

Could you share me how to integrate graphql :slight_smile:

My website is Open-Source, feel free to have a look around these places in particular:



It’s kind of a hot mess but oh well.
Am still considering to make a nicer to use GraphQL integration for OSS

1 Like