Skip to content

Commit

Permalink
Request data optional
Browse files Browse the repository at this point in the history
  • Loading branch information
asvae committed Apr 18, 2017
1 parent f69aee8 commit 7d446d4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
15 changes: 14 additions & 1 deletion config/api-tester.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,24 @@
| !WARNING!
| This sometimes causes fatal errors, rendering api tester unusable.
| Set to false if that's your case.
|
*/

'route_meta' => true,


/*
|--------------------------------------------------------------------------
| Request analysis
|--------------------------------------------------------------------------
| Display request rules..
|
| !WARNING!
| This sometimes causes fatal errors, rendering api tester unusable.
| Set to false if that's your case.
*/

'request_rules' => true,

/*
|--------------------------------------------------------------------------
| Filter routes
Expand Down
8 changes: 7 additions & 1 deletion src/Entities/RouteInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,17 @@ class RouteInfo implements Arrayable, JsonSerializable
*/
private $route;

/**
* @var bool
*/
private $analyzeRequests;

public function __construct($route, $options = [])
{
$this->route = $route;
$this->options = $options;
$this->addMeta = config('api-tester.route_meta');
$this->analyzeRequests = config('api-tester.analyze_requests');
}

/**
Expand Down Expand Up @@ -141,7 +147,7 @@ protected function extractFormRequest()
}

// Если это форм-реквест.
if (is_subclass_of($class->name, FormRequest::class)) {
if (is_subclass_of($class->name, FormRequest::class && $this->analyzeRequests)) {

// Для вызова нестатического метода на объекте, нам необходим инстанс объекта.
// Мы используем build вместо make, чтобы избежать автоматического запуска валидации.
Expand Down

0 comments on commit 7d446d4

Please sign in to comment.