/** * Checks if the status code does allow message body content. * @param \Brickoo\Component\Http\HttpResponse $response * @throws StatusCodeDoesNotAllowMessageBodyException * @return \Brickoo\Component\Http\HttpResponseSender */ private function checkStatusAllowsHttpMessageBodyContent(HttpResponse $response) { $statusCode = $response->getStatus()->getCode(); if ($response->getBody()->getContent() != "" && $this->statusDoesNotAllowBody($statusCode)) { throw new StatusCodeDoesNotAllowMessageBodyException($statusCode); } return $this; }
/** @covers Brickoo\Component\Http\HttpResponse::getBody */ public function testGetHttpMessageBody() { $body = new HttpMessageBody(); $httpResponse = new HttpResponse(new HttpVersion(HttpVersion::HTTP_1_1), new HttpStatus(HttpStatus::CODE_OK), new HttpMessage(new HttpMessageHeader(), $body)); $this->assertSame($body, $httpResponse->getBody()); }