cphalcon icon indicating copy to clipboard operation
cphalcon copied to clipboard

Phalcon\Http\Response::setContentType charset param not working

Open nesbert opened this issue 14 years ago • 1 comments

Unable to set charset when using the Phalcon\Http\Response::setContentType method. See unit test update below.

Thanks!


// ResponseTest.php

class ResponseTest extends PHPUnit_Framework_TestCase
{

    ...

    public function testSetContentType()
    {

        $this->_response->resetHeaders();
        $this->_response->setContentType('application/json', 'utf-8');

        $this->assertEquals(Phalcon\Http\Response\Headers::__set_state(array(
            '_headers' => array(
                'Content-Type' => 'application/json; charset=utf-8'
            )
        )), $this->_response->getHeaders());

    }

nesbert avatar Sep 12 '12 04:09 nesbert

Thanks nesbert, this is now fixed, good night

ghost avatar Sep 12 '12 05:09 ghost