/** * Test fetch DELETE params */ public function testDelete() { $env = \Slim\Environment::mock(array('REQUEST_METHOD' => 'DELETE', 'slim.input' => 'foo=bar&abc=123', 'CONTENT_TYPE' => 'application/x-www-form-urlencoded', 'CONTENT_LENGTH' => 15)); $req = new \Slim\Http\Request($env); $this->assertEquals(2, count($req->delete())); $this->assertEquals('bar', $req->delete('foo')); $this->assertEquals('bar', $req->params('foo')); $this->assertNull($req->delete('xyz')); $this->assertFalse($req->delete('xyz', false)); }
/** * Combines the request and route parameters into one array for * Honeybadger notices. * * @param Slim\Http\Request $request * @return array The combined request and route parameters. */ private function combined_params($request) { $router = $this->app->router(); // Find the matching route for the request, to extract parameters for // routes such as: `/books/:id`. $router->getMatchedRoutes($request->getMethod(), $request->getPathInfo()); if ($route = $router->getCurrentRoute()) { $params = $route->getParams(); } else { $params = array(); } // Merge the route and request parameters into one array. return Arr::merge($request->params(), $params); }