mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Replaced HTTPReponse settings of Content-type header with Content-Type, to match RestfulServer
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@70844 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
f5b22dadff
commit
3131b476a6
@ -29,7 +29,7 @@ class XMLDataFormatter extends DataFormatter {
|
|||||||
* @return String XML
|
* @return String XML
|
||||||
*/
|
*/
|
||||||
public function convertDataObject(DataObjectInterface $obj, $fields = null) {
|
public function convertDataObject(DataObjectInterface $obj, $fields = null) {
|
||||||
Controller::curr()->getResponse()->addHeader("Content-type", "text/xml");
|
Controller::curr()->getResponse()->addHeader("Content-Type", "text/xml");
|
||||||
return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" . $this->convertDataObjectWithoutHeader($obj, $fields);
|
return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" . $this->convertDataObjectWithoutHeader($obj, $fields);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ class XMLDataFormatter extends DataFormatter {
|
|||||||
* @return String XML
|
* @return String XML
|
||||||
*/
|
*/
|
||||||
public function convertDataObjectSet(DataObjectSet $set, $fields = null) {
|
public function convertDataObjectSet(DataObjectSet $set, $fields = null) {
|
||||||
Controller::curr()->getResponse()->addHeader("Content-type", "text/xml");
|
Controller::curr()->getResponse()->addHeader("Content-Type", "text/xml");
|
||||||
$className = $set->class;
|
$className = $set->class;
|
||||||
|
|
||||||
$xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
|
$xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
|
||||||
|
@ -112,7 +112,7 @@ class ContentNegotiator {
|
|||||||
|
|
||||||
// Only serve "pure" XHTML if the XML header is present
|
// Only serve "pure" XHTML if the XML header is present
|
||||||
if(substr($content,0,5) == '<' . '?xml' ) {
|
if(substr($content,0,5) == '<' . '?xml' ) {
|
||||||
$response->addHeader("Content-type", "application/xhtml+xml; charset=" . self::$encoding);
|
$response->addHeader("Content-Type", "application/xhtml+xml; charset=" . self::$encoding);
|
||||||
$response->addHeader("Vary" , "Accept");
|
$response->addHeader("Vary" , "Accept");
|
||||||
|
|
||||||
$content = str_replace(' ',' ', $content);
|
$content = str_replace(' ',' ', $content);
|
||||||
@ -134,7 +134,7 @@ class ContentNegotiator {
|
|||||||
* Removes "xmlns" attributes and any <?xml> Pragmas.
|
* Removes "xmlns" attributes and any <?xml> Pragmas.
|
||||||
*/
|
*/
|
||||||
function html(HTTPResponse $response) {
|
function html(HTTPResponse $response) {
|
||||||
$response->addHeader("Content-type", "text/html; charset=" . self::$encoding);
|
$response->addHeader("Content-Type", "text/html; charset=" . self::$encoding);
|
||||||
$response->addHeader("Vary", "Accept");
|
$response->addHeader("Vary", "Accept");
|
||||||
|
|
||||||
$content = $response->getBody();
|
$content = $response->getBody();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user