MvcLite\Response::setContentType
Setter for the content type.
Signature
public function setContentType([string
$contentType = ''] )
Parameters
$contentType
—
string
- The value to set the content type to.
Returns
- Response
- Returns $this, for object-chaining.
Errors/Exceptions
-
Exception
- If the content type is invalid, an exception is thrown.
Test Coverage
Information
- Coverage: 13/13 Lines (100%)
- Tests: 9
- Passed: 9 (100%)
Tests
- [ PASSED ] — MvcLite\DispatcherTest::testDispatch with data set "good controller request"
- [ PASSED ] — MvcLite\DispatcherTest::testDispatch with data set "bad controller request"
- [ PASSED ] — MvcLite\ResponseTest::testSetContentType with data set "No content type"
- [ PASSED ] — MvcLite\ResponseTest::testSetContentType with data set "Good content type (application/json)"
- [ PASSED ] — MvcLite\ResponseTest::testSetContentType with data set "Good content type (application/javascript)"
- [ PASSED ] — MvcLite\ResponseTest::testSetContentType with data set "Good content type (text/html)"
- [ PASSED ] — MvcLite\ResponseTest::testSetContentType with data set "Good content type (text/plain)"
- [ PASSED ] — MvcLite\ResponseTest::testSetContentType with data set "Good content type (text/csv)"
- [ PASSED ] — MvcLite\ResponseTest::testSetContentType with data set "Bad content type, expect exception"