public function testCanRedirectOnAjax2Request()
{
$this->assertTrue($this->actions->register('output5', "{$this->actionsDir}/output5.php", 'public'));
$this->request = $this->prepareHttpRequest('action/output5', 'POST', [], 2, true);
$this->createService();
set_input('output', 'foo');
$this->route();
$response = _elgg_services()->responseFactory->getSentResponse();
$this->assertInstanceOf(Response::class, $response);
$this->assertEquals(ELGG_HTTP_OK, $response->getStatusCode());
$this->assertContains('application/json', $response->headers->get('Content-Type'));
//$this->assertContains('charset=utf-8', strtolower($response->headers->get('Content-Type')));
$output = json_encode(['value' => 'foo', '_elgg_msgs' => (object) [], '_elgg_deps' => []]);
$this->assertEquals($output, $response->getContent());
// compensate for fact that ResponseFactory::redirect closes a buffer it didn't open
ob_start();
}