Merge pull request #55 from catalyst/master

FIX: make RestfulServer:: configurable
This commit is contained in:
Robbie Averill 2018-04-04 15:19:01 +12:00 committed by GitHub
commit 49f12cb31d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -331,15 +331,15 @@ class RestfulServer extends Controller
// get formatter // get formatter
if (!empty($extension)) { if (!empty($extension)) {
$formatter = DataFormatter::for_extension($extension); $formatter = DataFormatter::for_extension($extension);
} elseif ($includeAcceptHeader && !empty($accept) && $accept != '*/*') { } elseif ($includeAcceptHeader && !empty($accept) && strpos($accept, '*/*') === false) {
$formatter = DataFormatter::for_mimetypes($mimetypes); $formatter = DataFormatter::for_mimetypes($mimetypes);
if (!$formatter) { if (!$formatter) {
$formatter = DataFormatter::for_extension(self::$default_extension); $formatter = DataFormatter::for_extension($this->config()->default_extension);
} }
} elseif (!empty($contentType)) { } elseif (!empty($contentType)) {
$formatter = DataFormatter::for_mimetype($contentType); $formatter = DataFormatter::for_mimetype($contentType);
} else { } else {
$formatter = DataFormatter::for_extension(self::$default_extension); $formatter = DataFormatter::for_extension($this->config()->default_extension);
} }
if (!$formatter) { if (!$formatter) {