Skip to content

Commit 478116b

Browse files
committed
Fix
1 parent 6e8bb51 commit 478116b

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/Bridge/Symfony/Bundle/Test/Response.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313

1414
namespace ApiPlatform\Core\Bridge\Symfony\Bundle\Test;
1515

16-
use ApiPlatform\Core\Bridge\Symfony\Bundle\Test\Exception\ClientException;
17-
use ApiPlatform\Core\Bridge\Symfony\Bundle\Test\Exception\ServerException;
18-
use ApiPlatform\Core\Bridge\Symfony\Bundle\Test\Exception\RedirectionException;
1916
use Symfony\Component\BrowserKit\Response as BrowserKitResponse;
17+
use Symfony\Component\HttpClient\Exception\ClientException;
2018
use Symfony\Component\HttpClient\Exception\JsonException;
19+
use Symfony\Component\HttpClient\Exception\RedirectionException;
20+
use Symfony\Component\HttpClient\Exception\ServerException;
2121
use Symfony\Component\HttpFoundation\Response as HttpFoundationResponse;
2222
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
2323
use Symfony\Contracts\HttpClient\ResponseInterface;
@@ -80,15 +80,15 @@ private function checkStatusCode()
8080
}
8181

8282
if (500 <= $this->info['http_code']) {
83-
throw new ServerException($message, $this->info['http_code']);
83+
throw new ServerException($this);
8484
}
8585

8686
if (400 <= $this->info['http_code']) {
87-
throw new ClientException($message, $this->info['http_code']);
87+
throw new ClientException($this);
8888
}
8989

9090
if (300 <= $this->info['http_code']) {
91-
throw new RedirectionException($message, $this->info['http_code']);
91+
throw new RedirectionException($this);
9292
}
9393
}
9494

@@ -134,6 +134,7 @@ public function toArray(bool $throw = true): array
134134
}
135135

136136
if ('' === $content = $this->getContent($throw)) {
137+
throw new TransportExceptionInterface($this);
137138
throw new class(sprintf('Response body is empty.', $contentType)) extends \Exception implements TransportExceptionInterface {
138139
};
139140
}

0 commit comments

Comments
 (0)