public setHttpMethod ( string $method ) | ||
$method | string | Method name. |
public function setHttpMethod($method)
{
$method = strtolower($method);
if (!in_array($method, self::$supportedRequestTypes)) {
throw new RestException('The provided HTTP is no supported: "' . $method . '".');
}
$this->method = $method;
}
public function testResourceNamingWithParams() { $url = 'http://api.example.com/mock-api-class-router/some-url/123/name/John Snow'; $r = new Router('ExampleApi', 'Webiny\\Component\\Rest\\Tests\\Mocks\\MockApiClassRouter', true, self::$cache); $r->setUrl($url); $r->setHttpMethod('get'); $result = $r->processRequest(); $this->assertSame('123 => John Snow', $result->getOutput()['data']); }