mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Format for SS3 using tabs instead of spaces
This commit is contained in:
parent
f7c270a3ba
commit
fc5e584201
@ -358,10 +358,10 @@ class HTTP {
|
|||||||
|
|
||||||
// To do: User-Agent should only be added in situations where you *are* actually
|
// To do: User-Agent should only be added in situations where you *are* actually
|
||||||
// varying according to user-agent.
|
// varying according to user-agent.
|
||||||
$vary = $config->get('HTTP', 'vary');
|
$vary = $config->get('HTTP', 'vary');
|
||||||
if ($vary && strlen($vary)) {
|
if ($vary && strlen($vary)) {
|
||||||
$responseHeaders['Vary'] = $vary;
|
$responseHeaders['Vary'] = $vary;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if($body) {
|
if($body) {
|
||||||
|
@ -48,28 +48,28 @@ class HTTPTest extends FunctionalTest {
|
|||||||
|
|
||||||
|
|
||||||
public function testConfigVary() {
|
public function testConfigVary() {
|
||||||
$body = "<html><head></head><body><h1>Mysite</h1></body></html>";
|
$body = "<html><head></head><body><h1>Mysite</h1></body></html>";
|
||||||
$response = new SS_HTTPResponse($body, 200);
|
$response = new SS_HTTPResponse($body, 200);
|
||||||
Config::inst()->update('Director', 'environment_type', 'live');
|
Config::inst()->update('Director', 'environment_type', 'live');
|
||||||
HTTP::set_cache_age(30);
|
HTTP::set_cache_age(30);
|
||||||
HTTP::add_cache_headers($response);
|
HTTP::add_cache_headers($response);
|
||||||
|
|
||||||
$v = $response->getHeader('Vary');
|
$v = $response->getHeader('Vary');
|
||||||
$this->assertNotEmpty($v);
|
$this->assertNotEmpty($v);
|
||||||
|
|
||||||
$this->assertContains("Cookie", $v);
|
$this->assertContains("Cookie", $v);
|
||||||
$this->assertContains("X-Forwarded-Protocol", $v);
|
$this->assertContains("X-Forwarded-Protocol", $v);
|
||||||
$this->assertContains("User-Agent", $v);
|
$this->assertContains("User-Agent", $v);
|
||||||
$this->assertContains("Accept", $v);
|
$this->assertContains("Accept", $v);
|
||||||
|
|
||||||
Config::inst()->update('HTTP', 'vary', '');
|
Config::inst()->update('HTTP', 'vary', '');
|
||||||
|
|
||||||
$response = new SS_HTTPResponse($body, 200);
|
$response = new SS_HTTPResponse($body, 200);
|
||||||
HTTP::add_cache_headers($response);
|
HTTP::add_cache_headers($response);
|
||||||
|
|
||||||
$v = $response->getHeader('Vary');
|
$v = $response->getHeader('Vary');
|
||||||
$this->assertEmpty($v);
|
$this->assertEmpty($v);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests {@link HTTP::getLinksIn()}
|
* Tests {@link HTTP::getLinksIn()}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user