Throw on invalid Conduit method parameters
Summary: NOTE: This may break stuff.
Test Plan:
$ echo '{}' | arc call-conduit conduit.ping
$ echo '{"x": 1}' | arc call-conduit conduit.ping
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4191
This commit is contained in:
@@ -11,14 +11,22 @@
|
||||
final class ConduitCall {
|
||||
|
||||
private $method;
|
||||
private $params;
|
||||
private $request;
|
||||
private $user;
|
||||
|
||||
public function __construct($method, array $params) {
|
||||
$this->method = $method;
|
||||
$this->params = $params;
|
||||
$this->handler = $this->buildMethodHandler($method);
|
||||
|
||||
$invalid_params = array_diff_key(
|
||||
$params,
|
||||
$this->handler->defineParamTypes());
|
||||
if ($invalid_params) {
|
||||
throw new ConduitException(
|
||||
"Method '{$method}' doesn't define these parameters: '" .
|
||||
implode("', '", array_keys($invalid_params)) . "'.");
|
||||
}
|
||||
|
||||
$this->request = new ConduitAPIRequest($params);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user