DefaultFormatTestController.php

Same filename in other branches
  1. 8.9.x core/modules/system/tests/modules/default_format_test/src/DefaultFormatTestController.php
  2. 10 core/modules/system/tests/modules/default_format_test/src/DefaultFormatTestController.php
  3. 11.x core/modules/system/tests/modules/default_format_test/src/DefaultFormatTestController.php

Namespace

Drupal\default_format_test

File

core/modules/system/tests/modules/default_format_test/src/DefaultFormatTestController.php

View source
<?php

namespace Drupal\default_format_test;

use Drupal\Core\Cache\CacheableResponse;
use Symfony\Component\HttpFoundation\Request;
class DefaultFormatTestController {
    public function content(Request $request) {
        $format = $request->getRequestFormat();
        return new CacheableResponse('format:' . $format, 200, [
            'Content-Type' => $request->getMimeType($format),
        ]);
    }

}

Classes

Title Deprecated Summary
DefaultFormatTestController

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.