$this->headers['Content-Security-Policy'] = $this->getContentSecurityPolicy()->buildPolicy();
$this->headers['Feature-Policy'] = $this->getFeaturePolicy()->buildPolicy();
+ $this->headers['X-Robots-Tag'] = 'none';
if ($this->ETag) {
$mergeWith['ETag'] = '"' . $this->ETag . '"';
// \OCP\Template needs an empty string instead of 'blank' for an unwrapped response
$renderAs = $this->renderAs === 'blank' ? '' : $this->renderAs;
+ \OCP\Util::addHeader('meta', ['name' => 'robots', 'content' => 'noindex, nofollow']);
$template = new \OCP\Template($this->appName, $this->templateName, $renderAs);
foreach ($this->params as $key => $value) {
$this->controller = new ChildController($this->app, $request);
}
-
+
public function testFormatResonseInvalidFormat() {
$this->expectException(\DomainException::class);
'Content-Type' => 'application/json; charset=utf-8',
'Content-Security-Policy' => "default-src 'none';base-uri 'none';manifest-src 'self'",
'Feature-Policy' => "autoplay 'none';camera 'none';fullscreen 'none';geolocation 'none';microphone 'none';payment 'none'",
+ 'X-Robots-Tag' => 'none',
];
$response = $this->controller->customDataResponse(['hi']);
'Cache-Control' => 'no-cache, no-store, must-revalidate',
'Content-Security-Policy' => "default-src 'none';base-uri 'none';manifest-src 'self'",
'Feature-Policy' => "autoplay 'none';camera 'none';fullscreen 'none';geolocation 'none';microphone 'none';payment 'none'",
+ 'X-Robots-Tag' => 'none',
];
$expectedHeaders = array_merge($expectedHeaders, $headers);
$expected = [
'Last-Modified' => 1,
'ETag' => 3,
- 'Something-Else' => 'hi'
+ 'Something-Else' => 'hi',
+ 'X-Robots-Tag' => 'none',
];
$this->childResponse->setHeaders($expected);
public function testAddHeaderValueNullDeletesIt() {
$this->childResponse->addHeader('hello', 'world');
$this->childResponse->addHeader('hello', null);
- $this->assertEquals(3, count($this->childResponse->getHeaders()));
+ $this->assertEquals(4, count($this->childResponse->getHeaders()));
}