update bug daashboards
This commit is contained in:
67
vendor/knuckleswtf/scribe/camel/Extraction/Response.php
vendored
Normal file
67
vendor/knuckleswtf/scribe/camel/Extraction/Response.php
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace Knuckles\Camel\Extraction;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use Knuckles\Camel\BaseDTO;
|
||||
|
||||
class Response extends BaseDTO
|
||||
{
|
||||
public int $status;
|
||||
|
||||
public ?string $content;
|
||||
|
||||
public array $headers = [];
|
||||
|
||||
public ?string $description;
|
||||
|
||||
public function __construct(array $parameters = [])
|
||||
{
|
||||
if (is_array($parameters['content'] ?? null)) {
|
||||
$parameters['content'] = json_encode($parameters['content'], JSON_UNESCAPED_SLASHES);
|
||||
}
|
||||
|
||||
if (isset($parameters['status'])) {
|
||||
$parameters['status'] = (int) $parameters['status'];
|
||||
}
|
||||
|
||||
$hiddenHeaders = [
|
||||
'date',
|
||||
'Date',
|
||||
'etag',
|
||||
'ETag',
|
||||
'last-modified',
|
||||
'Last-Modified',
|
||||
'date',
|
||||
'Date',
|
||||
'content-length',
|
||||
'Content-Length',
|
||||
'connection',
|
||||
'Connection',
|
||||
'x-powered-by',
|
||||
'X-Powered-By',
|
||||
];
|
||||
if (! empty($parameters['headers'])) {
|
||||
foreach ($hiddenHeaders as $headerName) {
|
||||
unset($parameters['headers'][$headerName]);
|
||||
}
|
||||
}
|
||||
|
||||
parent::__construct($parameters);
|
||||
}
|
||||
|
||||
public function fullDescription()
|
||||
{
|
||||
$description = $this->status;
|
||||
if ($this->description) {
|
||||
$description .= ", {$this->description}";
|
||||
}
|
||||
|
||||
return $description;
|
||||
}
|
||||
|
||||
public function isBinary(): bool
|
||||
{
|
||||
return is_string($this->content) && Str::startsWith($this->content, '<<binary>>');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user