Skip to content

Commit

Permalink
validator default
Browse files Browse the repository at this point in the history
  • Loading branch information
stelin committed Mar 21, 2018
1 parent c2a7659 commit 4f4c9a8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Http/HttpServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public function start()
if (!empty($this->setting['open_http2_protocol'])) {
$this->httpSetting['type'] = SWOOLE_SOCK_TCP|SWOOLE_SSL;
}

$this->server = new Server($this->httpSetting['host'], $this->httpSetting['port'], $this->httpSetting['mode'], $this->httpSetting['type']);

// Bind event callback
Expand Down
2 changes: 2 additions & 0 deletions src/Validator/HttpValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ private function validateField($request, array $matches, string $type, array $va
if ($type === ValidatorFrom::GET) {
if (! isset($get[$name])) {
$request = $request->addQueryParam($name, $default);
$this->doValidation($name, $default, $info);
continue;
}
$this->doValidation($name, $get[$name], $info);
Expand All @@ -67,6 +68,7 @@ private function validateField($request, array $matches, string $type, array $va
if ($type === ValidatorFrom::POST && \is_array($post)) {
if (! isset($post[$name])) {
$request = $request->addParserBody($name, $default);
$this->doValidation($name, $default, $info);
continue;
}
$this->doValidation($name, $post[$name], $info);
Expand Down

0 comments on commit 4f4c9a8

Please sign in to comment.