public static function allowMethod(int $method, array $methods) { if (in_array(Http::getMethod('ALL'), $methods)) { return true; } if (in_array($method, $methods)) { return true; } return false; }
public function testGetRequest() { $_REQUEST['_url'] = '/this/is/a/test'; $_SERVER['REQUEST_METHOD'] = 'GET'; $_SERVER['HTTP_BAR_FOO'] = 'foo-bar'; $request = new Http(); $this->assertEquals(['this', 'is', 'a', 'test'], $request->get()); $this->assertEquals('GET', $request->getMethod()); $this->assertEquals('foo-bar', $request->getHeader('bar-foo')); $this->assertEquals(['bar-foo' => 'foo-bar'], $request->getHeader()); }