Repository: falconry/falcon

Issue:
Request.client_accepts_msgpack only supports 'application/x-msgpack'
The use of the 'x-' prefix is now discouraged for media types. We should update this Request property to also return True for 'application/msgpack', and verify the change with additional tests.

Discussion:

Patch:
diff --git a/falcon/request.py b/falcon/request.py
index 54be8c0..bd83227 100644
--- a/falcon/request.py
+++ b/falcon/request.py
@@ -353,7 +353,8 @@ class Request(object):
 
     @property
     def client_accepts_msgpack(self):
-        return self.client_accepts('application/x-msgpack')
+        return (self.client_accepts('application/x-msgpack')
+                or self.client_accepts('application/msgpack'))
 
     @property
     def client_accepts_xml(self):


Test patch:
diff --git a/tests/test_req_vars.py b/tests/test_req_vars.py
index 9e88754..c71f02e 100644
--- a/tests/test_req_vars.py
+++ b/tests/test_req_vars.py
@@ -348,6 +348,12 @@ class TestReqVars(testing.TestBase):
         self.assertFalse(req.client_accepts_json)
         self.assertTrue(req.client_accepts_msgpack)
 
+        headers = {'Accept': 'application/msgpack'}
+        req = Request(testing.create_environ(headers=headers))
+        self.assertFalse(req.client_accepts_xml)
+        self.assertFalse(req.client_accepts_json)
+        self.assertTrue(req.client_accepts_msgpack)
+
         headers = {
             'Accept': 'application/json,application/xml,application/x-msgpack'
         }