Skip to content

Commit f6eba5c

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

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,17 @@ public function testThrowsBadRequestExceptionOnBadRequestResponse()
212212
$this->expectException(BadRequestException::class);
213213
$this->expectExceptionMessage('Bad Request: invalid parameters');
214214

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

0 commit comments

Comments
 (0)