contentType() public method

Get the content type used in this request.
public contentType ( ) : string
return string
Example #1
0
 /**
  * Test the content type method.
  * 
  * @return void
  */
 public function testContentType()
 {
     $_SERVER['HTTP_CONTENT_TYPE'] = 'application/json';
     $request = new CakeRequest('/', false);
     $this->assertEquals('application/json', $request->contentType());
     $_SERVER['CONTENT_TYPE'] = 'application/xml';
     $request = new CakeRequest('/', false);
     $this->assertEquals('application/xml', $request->contentType(), 'prefer non http header.');
 }