formats: Add getMimeType() function (#1299)

Allows getting the expected MIME type of the format's output. A
corresponding MIME_TYPE constant is also defined in FormatAbstract for
the format implementations to overwrite.
This commit is contained in:
Roliga 2019-10-31 19:00:12 +01:00 committed by LogMANOriginal
parent d1e4bd7285
commit c8d5c85c76
7 changed files with 30 additions and 5 deletions

View file

@ -8,6 +8,8 @@
* https://github.com/vigetlabs/json-feed-validator
*/
class JsonFormat extends FormatAbstract {
const MIME_TYPE = 'application/json';
const VENDOR_EXCLUDES = array(
'author',
'title',
@ -119,7 +121,7 @@ class JsonFormat extends FormatAbstract {
public function display(){
$this
->setContentType('application/json; charset=' . $this->getCharset())
->setContentType(self::MIME_TYPE . '; charset=' . $this->getCharset())
->callContentType();
return parent::display();