Skip to content

Commit 23d0bf7

Browse files
fix: asterisk characters were not supported in request urls (#23)
1 parent cfe08ad commit 23d0bf7

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## v3.0.1 - 2022-06-28
4+
5+
- Fix a bug where asterisk characters were not supported in request url's
6+
37
## v3.0.0 - 2021-10-01
48

59
- Request: Add ability to add custom query parameters to requests

src/Attribute/Id.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,4 @@
77
#[\Attribute(\Attribute::TARGET_PROPERTY)]
88
class Id
99
{
10-
1110
}

src/Model/Request/Request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function __construct(
8282
private function parseUriPath(string $path): void
8383
{
8484
preg_match(
85-
'/^(([a-zA-Z0-9_\-.\/]+.php)(\/)|)(' . $this->apiPrefix . ')([\/a-zA-Z0-9_\-.]+)$/',
85+
'/^(([a-zA-Z0-9_\-.\/]+.php)(\/)|)(' . $this->apiPrefix . ')([\/a-zA-Z0-9_\-*.]+)$/',
8686
trim($path, '/'),
8787
$matches
8888
);

tests/Model/Request/RequestTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,4 +339,16 @@ public function testCustomQueryParameters(): void
339339
self::assertArrayHasKey($queryKey, $requestQuery);
340340
self::assertEquals($queryValue, $requestQuery[$queryKey]);
341341
}
342+
343+
public function testUrlWithAsteriskCharacter(): void
344+
{
345+
$request = new Request(
346+
'GET',
347+
new Uri('/index.php/api/examples/*.example-1'),
348+
null,
349+
'api'
350+
);
351+
352+
self::assertEquals('*.example-1', $request->id());
353+
}
342354
}

0 commit comments

Comments
 (0)