You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey thought I'd let you know I had trouble with the invoke method because I wanted to see the status code and headers, and that method only returns the content inside the response. No biggie I just subclassed and reimplemented that method to return an array of those things, also renamed a few variables:
// Dispatch request.
$response = $this->router->dispatch($request);
if (method_exists($response, 'getOriginalContent'))
{
$responseBody = $response->getOriginalContent();
}
else
{
$responseBody = $response->getContent();
}
// Decode json content.
if ($response->headers->get('content-type') == 'application/json')
{
if (function_exists('json_decode') and is_string($responseBody))
{
$responseBody = json_decode($responseBody, true);
}
}
// Restore the request input and route back to the original state.
$this->request->replace($originalInput);
$result['body'] = $responseBody;
$result['status'] = $response->getStatusCode();
$result['header'] = $response->headers->all();
return $result;
The text was updated successfully, but these errors were encountered:
Hey thought I'd let you know I had trouble with the invoke method because I wanted to see the status code and headers, and that method only returns the content inside the response. No biggie I just subclassed and reimplemented that method to return an array of those things, also renamed a few variables:
The text was updated successfully, but these errors were encountered: