diff --git a/phpstan.neon b/phpstan.neon
index 4ee88fdc..b3ba7ee8 100644
--- a/phpstan.neon
+++ b/phpstan.neon
@@ -12,6 +12,7 @@ parameters:
- src/aliases.php
- src/Tracing/Doctrine/DBAL/TracingStatementForV2.php
- src/Tracing/Doctrine/DBAL/TracingDriverForV2.php
+ - src/Tracing/HttpClient/TraceableHttpClientForV4.php
- src/Tracing/HttpClient/TraceableHttpClientForV5.php
- tests/End2End/App
- tests/Tracing/Doctrine/DBAL/TracingDriverForV2Test.php
diff --git a/psalm.xml b/psalm.xml
index abb144f4..89240539 100644
--- a/psalm.xml
+++ b/psalm.xml
@@ -11,6 +11,7 @@
+
diff --git a/tests/Tracing/HttpClient/TraceableHttpClientTest.php b/tests/Tracing/HttpClient/TraceableHttpClientTest.php
index 1c48069b..5126beb1 100644
--- a/tests/Tracing/HttpClient/TraceableHttpClientTest.php
+++ b/tests/Tracing/HttpClient/TraceableHttpClientTest.php
@@ -11,6 +11,7 @@
use Psr\Log\NullLogger;
use Sentry\SentryBundle\Tracing\HttpClient\AbstractTraceableResponse;
use Sentry\SentryBundle\Tracing\HttpClient\TraceableHttpClient;
+use Sentry\SentryBundle\Tracing\HttpClient\TraceableResponse;
use Sentry\State\HubInterface;
use Sentry\Tracing\Transaction;
use Sentry\Tracing\TransactionContext;
@@ -155,6 +156,33 @@ public function testWithOptions(): void
$this->assertSame('https://www.example.org/test-page', $response->getInfo('url'));
}
+ public function testStream(): void
+ {
+ if (!method_exists(MockHttpClient::class, 'stream')) {
+ self::markTestSkipped();
+ }
+
+ $transaction = new Transaction(new TransactionContext());
+ $transaction->initSpanRecorder();
+
+ $mockResponse = MockResponse::fromRequest('GET', 'https://www.example.com', [], new MockResponse('test_body', ['http_code' => 201]));
+ $decoratedHttpClient = new MockHttpClient([$mockResponse], 'https://www.example.com');
+ $httpClient = new TraceableHttpClient($decoratedHttpClient, $this->hub);
+ $response = new TraceableResponse($decoratedHttpClient, $mockResponse, $transaction);
+
+ $stream = $httpClient->stream([$response]);
+ $chunks = iterator_to_array($stream, false);
+
+ $this->assertCount(3, $chunks);
+
+ $spans = $transaction->getSpanRecorder()->getSpans();
+ $this->assertCount(1, $spans);
+ $this->assertNotNull($spans[0]->getEndTimestamp());
+
+ $this->assertEquals('test_body', $response->getContent(false));
+ $this->assertEquals(201, $response->getStatusCode());
+ }
+
private static function isHttpClientPackageInstalled(): bool
{
return interface_exists(HttpClientInterface::class);