Change of condition "content-type" #22

Merged
Arsen Mirzaev Tatyano-Muradovich merged 1 commits from Hollspae/minimal:stable into stable 2025-09-13 17:25:39 +07:00

View File

@@ -324,13 +324,16 @@ final class request
bool $environment = false
) {
// Writing method from argument into the property
if (isset($method)) $this->method = $method;
if (isset($method))
$this->method = $method;
// Writing URI from argument into the property
if (isset($uri)) $this->uri = $uri;
if (isset($uri))
$this->uri = $uri;
// Writing verstion of HTTP protocol from argument into the property
if (isset($protocol)) $this->protocol = $protocol;
if (isset($protocol))
$this->protocol = $protocol;
if (isset($headers)) {
// Received headers
@@ -363,10 +366,12 @@ final class request
}
// Writing parameters from argument into the property
if (isset($parameters)) $this->parameters = $parameters;
if (isset($parameters))
$this->parameters = $parameters;
// Writing files from argument into the property
if (isset($files)) $this->files = $files;
if (isset($files))
$this->files = $files;
if ($environment) {
// Requested to write values from environment
@@ -410,7 +415,7 @@ final class request
unset($buffer);
}
if (str_starts_with($this->headers['content-type'], content::json->value)) {
if (str_starts_with($this->headers['content-type'] ?? '', content::json->value)) {
// The body contains "application/json"
// Initializing data from the input buffer
@@ -467,8 +472,10 @@ final class request
}
// Validating of required properties
if (empty($this->method)) throw new exception_argument('Failed to initialize method of the request', status::internal_server_error->value);
if (empty($this->uri)) throw new exception_argument('Failed to initialize URI of the request', status::internal_server_error->value);
if (empty($this->method))
throw new exception_argument('Failed to initialize method of the request', status::internal_server_error->value);
if (empty($this->uri))
throw new exception_argument('Failed to initialize URI of the request', status::internal_server_error->value);
}
/**