Skip to content

Commit 2eb714d

Browse files
committed
Add test to cover BadRequestException for responses without a body
1 parent 8c84477 commit 2eb714d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/platform/tests/Bridge/OpenAi/Gpt/ResultConverterTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,4 +214,16 @@ public function testThrowsBadRequestExceptionOnBadRequestResponse()
214214

215215
$converter->convert(new RawHttpResult($httpResponse));
216216
}
217+
218+
public function testThrowsBadRequestExceptionOnBadRequestResponseWithNoResponseBody()
219+
{
220+
$converter = new ResultConverter();
221+
$httpResponse = self::createMock(ResponseInterface::class);
222+
$httpResponse->method('getStatusCode')->willReturn(400);
223+
224+
$this->expectException(BadRequestException::class);
225+
$this->expectExceptionMessage('Bad Request');
226+
227+
$converter->convert(new RawHttpResult($httpResponse));
228+
}
217229
}

0 commit comments

Comments
 (0)