Skip to content

Commit 26e0b65

Browse files
committed
convert uri to path
1 parent f2d86bb commit 26e0b65

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

src/Http/Http.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
class Http implements HttpContract
1919
{
20-
public static function packRequest(string $method, string|Stringable $uri, array $headers = [], string|Stringable $body = '', string $protocolVersion = HttpContract::DEFAULT_PROTOCOL_VERSION): string
20+
public static function packRequest(string $method, string|Stringable $path, array $headers = [], string|Stringable $body = '', string $protocolVersion = HttpContract::DEFAULT_PROTOCOL_VERSION): string
2121
{
2222
$headerString = '';
2323
foreach ($headers as $key => $values) {
@@ -29,7 +29,7 @@ public static function packRequest(string $method, string|Stringable $uri, array
2929
return sprintf(
3030
"%s %s HTTP/%s\r\n%s\r\n%s",
3131
$method,
32-
$uri,
32+
$path,
3333
$protocolVersion,
3434
$headerString,
3535
$body

tests/Cases/HttpTest.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,13 @@ public function testHttpPackRequest()
2424
{
2525
$data = Http::packRequest('GET', '/', ['Content-Type' => 'application/json'], 'Hello World');
2626

27-
$this->assertSame("GET / HTTP/1.1\r
28-
Content-Type: application/json\r
29-
\r
30-
Hello World", $data);
27+
$this->assertSame("GET / HTTP/1.1\r\nContent-Type: application/json\r\n\r\nHello World", $data);
3128
}
3229

3330
public function testHttpPackResponse()
3431
{
3532
$data = Http::packResponse(200, 'OK', ['Content-Type' => 'application/json'], 'Hello World');
3633

37-
$this->assertSame("HTTP/1.1 200 OK\r
38-
Content-Type: application/json\r
39-
\r
40-
Hello World", $data);
34+
$this->assertSame("HTTP/1.1 200 OK\r\nContent-Type: application/json\r\n\r\nHello World", $data);
4135
}
4236
}

0 commit comments

Comments
 (0)