Skip to content

Commit 2ed9d22

Browse files
committed
Add IpAddress middleware for #519
1 parent 168f8a2 commit 2ed9d22

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

api.php

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3261,7 +3261,7 @@ public function __construct(Router $router, Responder $responder, array $propert
32613261
$this->utils = new RequestUtils($reflection);
32623262
}
32633263

3264-
private function callHandler($handler, $record, String $operation, ReflectedTable $table) /*: object */
3264+
private function callHandler($record, String $operation, ReflectedTable $table) /*: object */
32653265
{
32663266
$context = (array) $record;
32673267
$columnName = $this->getProperty('column', '');
@@ -3283,18 +3283,15 @@ public function handle(Request $request): Response
32833283
if ($this->reflection->hasTable($tableName)) {
32843284
$record = $request->getBody();
32853285
if ($record !== null) {
3286-
$handler = $this->getProperty('handler', '');
3287-
if ($handler !== '') {
3288-
$table = $this->reflection->getTable($tableName);
3289-
if (is_array($record)) {
3290-
foreach ($record as &$r) {
3291-
$r = $this->callHandler($handler, $r, $operation, $table);
3292-
}
3293-
} else {
3294-
$record = $this->callHandler($handler, $record, $operation, $table);
3286+
$table = $this->reflection->getTable($tableName);
3287+
if (is_array($record)) {
3288+
foreach ($record as &$r) {
3289+
$r = $this->callHandler($r, $operation, $table);
32953290
}
3296-
$request->setBody($record);
3291+
} else {
3292+
$record = $this->callHandler($record, $operation, $table);
32973293
}
3294+
$request->setBody($record);
32983295
}
32993296
}
33003297
}

0 commit comments

Comments
 (0)