diff --git a/src/Route.php b/src/Route.php
index e3359cce..dc870ffe 100644
--- a/src/Route.php
+++ b/src/Route.php
@@ -13,13 +13,13 @@ final class Route
 		$this->regex = $this->getRegex();
 	}
 
-	public function handle($query)
+	public function handle($query, &$output)
 	{
 		$query = trim($query, '/');
 		if (!preg_match($this->regex, $query, $matches))
 			return false;
 		$routeArguments = $this->getRouteArguments($matches);
-		call_user_func_array($this->route, $routeArguments);
+		$output = call_user_func_array($this->route, $routeArguments);
 		return true;
 	}
 
diff --git a/src/Router.php b/src/Router.php
index a8683702..d1223a18 100644
--- a/src/Router.php
+++ b/src/Router.php
@@ -37,8 +37,10 @@ final class Router
 
 		foreach ($this->routes[$method] as $route)
 		{
-			if ($route->handle($request))
-				return;
+			if ($route->handle($request, $output))
+			{
+				return $output;
+				}
 		}
 
 		throw new \DomainException('Unhandled request address: ' . $request);
diff --git a/tests/RouterTest.php b/tests/RouterTest.php
index 3f4526ca..588cfde7 100644
--- a/tests/RouterTest.php
+++ b/tests/RouterTest.php
@@ -97,4 +97,12 @@ final class PostDaoTest extends \PHPUnit_Framework_TestCase
 		$router->handle('GET', '/tests/test_id');
 		$this->assertTrue($testOk);
 	}
+
+	public function testOutputHandling()
+	{
+		$router = new \Szurubooru\Router;
+		$router->get('/test', function() { return 'ok'; });
+		$output = $router->handle('GET', '/test');
+		$this->assertEquals('ok', $output);
+	}
 }