Development

Changeset 7776

You must first sign up to be able to contribute.

Changeset 7776

Show
Ignore:
Timestamp:
03/08/08 08:06:03 (1 year ago)
Author:
fabien
Message:

added a content_type option to sfWebResponse

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.1/lib/response/sfWebResponse.class.php

    r7733 r7776  
    9999      $this->options['charset'] = 'utf-8'; 
    100100    } 
     101 
     102    $this->setContentType(isset($this->options['content_type']) ? $this->options['content_type'] : 'text/html'); 
    101103  } 
    102104 
     
    270272  public function getContentType() 
    271273  { 
    272     return $this->getHttpHeader('Content-Type', 'text/html; charset='.$this->options['charset']); 
     274    return $this->getHttpHeader('Content-Type'); 
    273275  } 
    274276 
  • branches/1.1/test/unit/response/sfWebResponseTest.php

    r7733 r7776  
    1111require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 
    1212 
    13 $t = new lime_test(70, new lime_output_color()); 
     13$t = new lime_test(72, new lime_output_color()); 
    1414 
    1515class myWebResponse extends sfWebResponse 
     
    2727 
    2828$dispatcher = new sfEventDispatcher(); 
     29 
     30// ->initialize() 
     31$t->diag('->initialize()'); 
     32$response = new myWebResponse($dispatcher, array('charset' => 'ISO-8859-1')); 
     33$t->is($response->getContentType(), 'text/html; charset=ISO-8859-1', '->initialize() takes a "charset" option'); 
     34$response = new myWebResponse($dispatcher, array('content_type' => 'text/plain')); 
     35$t->is($response->getContentType(), 'text/plain; charset=utf-8', '->initialize() takes a "content_type" option'); 
    2936 
    3037$response = new myWebResponse($dispatcher); 
     
    98105$t->diag('->getContentType() ->setContentType()'); 
    99106 
     107$response = new myWebResponse($dispatcher); 
    100108$t->is($response->getContentType(), 'text/html; charset=utf-8', '->getContentType() returns a sensible default value'); 
    101109 

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting, and supporting several large Open-Source projects.