Updated to restructured Index version.

This commit is contained in:
flash 2024-10-05 00:04:26 +00:00
parent de27da54b6
commit cf6653ed46
6 changed files with 786 additions and 78 deletions

View file

@ -1 +1 @@
1.0.0 1.1.0

View file

@ -7,7 +7,7 @@
"require": { "require": {
"php": ">=8.3", "php": ">=8.3",
"ext-msgpack": ">=2.2", "ext-msgpack": ">=2.2",
"flashwave/index": "^0.2408.40014" "flashwave/index": "^0.2410"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^11.2", "phpunit/phpunit": "^11.2",

834
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
<?php <?php
// CurlHttpRequest.php // CurlHttpRequest.php
// Created: 2024-08-13 // Created: 2024-08-13
// Updated: 2024-08-16 // Updated: 2024-10-05
namespace Aiwass\Client; namespace Aiwass\Client;
@ -20,7 +20,11 @@ class CurlHttpRequest implements IHttpRequest {
private string $paramString = ''; private string $paramString = '';
public function __construct() { public function __construct() {
$this->handle = curl_init(); $handle = curl_init();
if($handle === false)
throw new RuntimeException('failed to initialise cURL request');
$this->handle = $handle;
curl_setopt_array($this->handle, [ curl_setopt_array($this->handle, [
CURLOPT_AUTOREFERER => false, CURLOPT_AUTOREFERER => false,
CURLOPT_FAILONERROR => false, CURLOPT_FAILONERROR => false,

View file

@ -1,17 +1,17 @@
<?php <?php
// IHttpRequest.php // IHttpRequest.php
// Created: 2024-08-13 // Created: 2024-08-13
// Updated: 2024-08-16 // Updated: 2024-10-05
namespace Aiwass\Client; namespace Aiwass\Client;
use RuntimeException; use RuntimeException;
use Index\ICloseable; use Index\Closeable;
/** /**
* Provides a common interface for making HTTP requests. * Provides a common interface for making HTTP requests.
*/ */
interface IHttpRequest extends ICloseable { interface IHttpRequest extends Closeable {
/** /**
* Sets whether this is a POST request or a GET request. * Sets whether this is a POST request or a GET request.
* *

View file

@ -1,7 +1,7 @@
<?php <?php
// RpcRouteHandler.php // RpcRouteHandler.php
// Created: 2024-08-13 // Created: 2024-08-13
// Updated: 2024-08-16 // Updated: 2024-10-05
namespace Aiwass\Server; namespace Aiwass\Server;
@ -9,13 +9,15 @@ use Exception;
use RuntimeException; use RuntimeException;
use Aiwass\{AiwassMsgPack,IVerificationProvider}; use Aiwass\{AiwassMsgPack,IVerificationProvider};
use Index\Http\{HttpResponseBuilder,HttpRequest}; use Index\Http\{HttpResponseBuilder,HttpRequest};
use Index\Http\Content\FormContent; use Index\Http\FormHttpContent;
use Index\Http\Routing\{HttpGet,HttpPost,RouteHandler}; use Index\Http\Routing\{HttpGet,HttpPost,RouteHandler,RouteHandlerTrait};
/** /**
* Provides a router implementation for an Aiwass RPC server. * Provides a router implementation for an Aiwass RPC server.
*/ */
class RpcRouteHandler extends RouteHandler { class RpcRouteHandler implements RouteHandler {
use RouteHandlerTrait;
/** /**
* @param IRpcServer $server An RPC server instance. * @param IRpcServer $server An RPC server instance.
* @param IVerificationProvider $verification A verification provider instance. * @param IVerificationProvider $verification A verification provider instance.
@ -41,7 +43,7 @@ class RpcRouteHandler extends RouteHandler {
if($request->getMethod() === 'POST') { if($request->getMethod() === 'POST') {
$content = $request->getContent(); $content = $request->getContent();
if(!($content instanceof FormContent)) if(!($content instanceof FormHttpContent))
return 400; return 400;
$expectProcedure = true; $expectProcedure = true;