From aee650defb22b769aff1bfe5d2e90e59d28f1c3f Mon Sep 17 00:00:00 2001 From: mark_story Date: Thu, 25 Aug 2011 22:33:21 -0400 Subject: [PATCH] Adding a test and fixing issues where q value had whitespace as well. Refs #1684 --- cake/libs/controller/components/request_handler.php | 2 +- .../cases/libs/controller/components/request_handler.test.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cake/libs/controller/components/request_handler.php b/cake/libs/controller/components/request_handler.php index a5682932d2b..32cf6391dc2 100644 --- a/cake/libs/controller/components/request_handler.php +++ b/cake/libs/controller/components/request_handler.php @@ -181,7 +181,7 @@ function __construct() { foreach ($this->__acceptTypes as $i => $type) { if (strpos($type, ';')) { $type = explode(';', $type); - $this->__acceptTypes[$i] = $type[0]; + $this->__acceptTypes[$i] = trim($type[0]); } } parent::__construct(); diff --git a/cake/tests/cases/libs/controller/components/request_handler.test.php b/cake/tests/cases/libs/controller/components/request_handler.test.php index a8632c8d8b6..4b01f7b1179 100644 --- a/cake/tests/cases/libs/controller/components/request_handler.test.php +++ b/cake/tests/cases/libs/controller/components/request_handler.test.php @@ -469,7 +469,7 @@ function testRequestContentTypes() { $this->_init(); $this->assertTrue($this->RequestHandler->isWap()); - $_SERVER['HTTP_ACCEPT'] = 'application/rss+xml , text/xml, application/xml,application/xhtml+xml'; + $_SERVER['HTTP_ACCEPT'] = 'application/rss+xml ;q=0.9 , text/xml, application/xml,application/xhtml+xml'; $this->_init(); $this->assertFalse($this->RequestHandler->isAtom()); $this->assertTrue($this->RequestHandler->isRSS());