Skip to content

Commit

Permalink
Merge branch '2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas committed Feb 16, 2017
2 parents d30effc + 6eaedcf commit 9f0b155
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/EventListener/AddFormatListener.php
Expand Up @@ -86,8 +86,11 @@ public function onKernelRequest(GetResponseEvent $event)
}

// Finally, if no Accept header nor Symfony request format is set, return the default format
reset($this->formats);
$request->setRequestFormat(each($this->formats)['key']);
foreach ($this->formats as $format => $mimeType) {
$request->setRequestFormat($format);

return;
}
}

/**
Expand Down
6 changes: 4 additions & 2 deletions src/Util/ErrorFormatGuesser.php
Expand Up @@ -39,8 +39,10 @@ public static function guessErrorFormat(Request $request, array $errorFormats):
return ['key' => $requestFormat, 'value' => $errorFormats[$requestFormat]];
}

reset($errorFormats);
foreach ($errorFormats as $key => $value) {
return ['key' => $key, 'value' => $value];
}

return each($errorFormats);
return [];
}
}

0 comments on commit 9f0b155

Please sign in to comment.