Merge branch 'develop' into develop
Some checks are pending
timw4mail/HummingBirdAnimeClient/pipeline/pr-develop Build started...

This commit is contained in:
Timothy Warren 2023-06-28 15:23:56 -04:00
commit 5de5afa4dc
4 changed files with 22 additions and 20 deletions

View File

@ -19,7 +19,8 @@ use const Aviat\AnimeClient\{
DEFAULT_CONTROLLER,
DEFAULT_CONTROLLER_METHOD,
NUM_PATTERN,
SLUG_PATTERN
SLUG_PATTERN,
SLUG_SPACE_PATTERN,
};
// -------------------------------------------------------------------------
@ -291,7 +292,7 @@ $routes = [
'action' => 'edit',
'tokens' => [
'id' => SLUG_PATTERN,
'status' => '([a-zA-Z\-_]|%20)+',
'status' => SLUG_SPACE_PATTERN,
],
],
'list' => [

View File

@ -14,8 +14,10 @@
namespace Aviat\AnimeClient\API;
// use Amp\Http\Client\Form;
use Amp\Http\Client\Body\FormBody;
use Amp\Http\Client\HttpClientBuilder;
use Amp\Http\Client\HttpException;
use Amp\Http\Client\Request;
use Aviat\Ion\Json;
@ -203,18 +205,15 @@ abstract class APIRequestBuilder
{
$this->buildUri();
if ($this->logger !== NULL)
{
$this->logger->debug('API Request', [
'request_url' => $this->request->getUri(),
'request_headers' => $this->request->getHeaders(),
'request_body' => wait(
$this->request->getBody()
->createBodyStream()
->read()
),
]);
}
$this->logger?->debug('API Request', [
'request_url' => $this->request->getUri(),
'request_headers' => $this->request->getHeaders(),
'request_body' => wait(
$this->request->getBody()
->createBodyStream()
->read()
),
]);
return $this->request;
}
@ -222,12 +221,11 @@ abstract class APIRequestBuilder
/**
* Get the data from the response of the passed request
*
* @throws Error
* @throws Throwable
* @throws TypeError
* @param Request $request
* @return mixed
* @throws Throwable
*/
public function getResponseData(Request $request)
public function getResponseData(Request $request): mixed
{
$response = getResponse($request);

View File

@ -28,6 +28,7 @@ const USER_AGENT = "Tim's Anime Client/5.2";
const ALPHA_SLUG_PATTERN = '[a-z_]+';
const NUM_PATTERN = '[0-9]+';
const SLUG_PATTERN = '[a-z0-9\-]+';
const SLUG_SPACE_PATTERN = '[a-zA-Z_\- ]+';
// Why doesn't this already exist?
const MILLI_FROM_NANO = 1000 * 1000;

View File

@ -2122,7 +2122,7 @@ abstract class Stringy implements Countable, IteratorAggregate, ArrayAccess
* Alias for mb_regex_encoding which default to a noop if the mbstring
* module is not installed.
*/
protected function regexEncoding(): mixed
protected function regexEncoding(): string|bool|null
{
static $functionExists;
@ -2137,6 +2137,8 @@ abstract class Stringy implements Countable, IteratorAggregate, ArrayAccess
return mb_regex_encoding(...$args);
}
return null;
}
protected function supportsEncoding(): bool|null