Account created on 6 March 2023, over 1 year ago
  • Application Engineer at JoinboxΒ  …
#

Recent comments

+1

Would be nice to be able to use multiple coupons from a promotion on one order with the possibility to limit the amount of coupons per order.

In a controller I send a Response and have a fallback RedirectResponse if that or other things didn't work; also because a controller needs to return some sort of response. For some reason this didn't work anymore and I got the described error message.
With the following changes it worked:

Old:

try {
  $service->getResponse($destination, $langcode)->send();
catch {
  // ...
}

return new RedirectResponse($destination, 302);

New:

try {
  $response = $service->getResponse($destination, $langcode);
  return new Response($response->getContent(), $response->getStatusCode(), $response->headers->all());
catch {
  // ...
}

return new RedirectResponse($destination, 302);

PS: I couldn't return the Response directly because it was a TrustedRedirectResponse with an external link which caused whole bunch of other problems.

Production build 0.69.0 2024