pull/97/head
Override-6 2 years ago committed by sam
parent ec69adab44
commit cfa9b40bc1

@ -17,6 +17,7 @@ class API {
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: *');
foreach ($response->getHeaders() as $header => $value) {
header("$header: $value");
}

@ -49,7 +49,6 @@ class APIAccountsController {
});
}
/**
* @param int $userId
* @return HttpResponse given user information.

@ -25,6 +25,7 @@ class Control {
if (!$payload_obj instanceof \stdClass) {
$fail = new ValidationFail("bad-payload", "request body is not a valid json object");
return $errorFactory->apply([$fail]);
}
$payload = get_object_vars($payload_obj);
return self::runCheckedFrom($payload, $schema, $run, $errorFactory);
@ -36,7 +37,6 @@ class Control {
* @param array<string, Validator[]> $schema an array of `fieldName => DefaultValidators` which represents the request object schema
* @param callable(HttpRequest): HttpResponse $run the callback to run if the request is valid according to the given schema.
* The callback must accept an HttpRequest, and return an HttpResponse object.
<<<<<<< HEAD:src/Core/Control.php
* @param ControlSchemaErrorResponseFactory $errorFactory an error factory to use if the request does not validate the required schema
* @return HttpResponse
*/
@ -46,6 +46,7 @@ class Control {
if (!empty($fails)) {
return $errorFactory->apply($fails);
}
return call_user_func_array($run, [$request]);

Loading…
Cancel
Save