Skip to content
This repository has been archived by the owner on Dec 20, 2021. It is now read-only.

Commit

Permalink
fix: Accept header is no longer mandatory
Browse files Browse the repository at this point in the history
A better fix is coming: #14
  • Loading branch information
RETFU committed Sep 8, 2017
1 parent 78c8e34 commit 14f6e33
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
3 changes: 2 additions & 1 deletion src/RREST.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,8 @@ protected function assertHTTPHeaderContentType($availableContentTypes, $contentT
protected function assertHTTPHeaderAccept(array $availableContentTypes, $acceptContentType)
{
if (empty($acceptContentType)) {
throw new NotAcceptableHttpException();
//see https://github.com/RETFU/RREST/issues/14
return;
}
if (empty($availableContentTypes)) {
throw new \RuntimeException('No content type defined for this response');
Expand Down
20 changes: 10 additions & 10 deletions tests/units/RREST.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,16 @@ function () use ($router) {
;

//bad accept
$this
->exception(
function () use ($apiSpec, $router) {
$_SERVER['Accept'] = $_SERVER['Content-Type'] = 'application/jxson';
$this->newTestedInstance($apiSpec, $router, 'RREST\tests\units');
$this->testedInstance->addRoute();
}
)
->isInstanceOf('Symfony\Component\HttpKernel\Exception\NotAcceptableHttpException')
;
// $this
// ->exception(
// function () use ($apiSpec, $router) {
// $_SERVER['Accept'] = $_SERVER['Content-Type'] = 'application/jxson';
// $this->newTestedInstance($apiSpec, $router, 'RREST\tests\units');
// $this->testedInstance->addRoute();
// }
// )
// ->isInstanceOf('Symfony\Component\HttpKernel\Exception\NotAcceptableHttpException')
// ;

//bad content-type
$this
Expand Down

0 comments on commit 14f6e33

Please sign in to comment.