public function testCreate() { $render = new Render(); $response = $render->send(['code' => 200, 'payload' => ['items' => [1, 2, 3, 4]]]); $this->assertEquals(200, $response->getStatusCode()); $this->assertEquals("application/json", $response->headers->get('content-type')); }
private function dispatchApi($endpoint) { $dispatcher = new LeraDispatcher($endpoint, \Request::getFacadeRoot(), \Config::getFacadeRoot(), \App::getFacadeRoot()); $render = new Render(); try { $response = $dispatcher->dispatch(); return $render->send($response); } catch (\Exception $e) { return $render->send(['code' => 500, 'payload' => ['error' => true, 'message' => $e->getMessage()]]); } }