Pecan assuming meter names are extensions

disable Pecan guessing content_type based on url path

Change-Id: I23862af3a9ae41980a8c3f33bf569acf9ff77a08
Fixes: Bug #1224132
This commit is contained in:
Gordon Chung 2013-09-11 17:47:21 -04:00
parent 46b51362da
commit f9fbaf2fdd
2 changed files with 10 additions and 0 deletions

View File

@ -77,6 +77,7 @@ def setup_app(pecan_config=None, extra_hooks=None):
force_canonical=getattr(pecan_config.app, 'force_canonical', True),
hooks=app_hooks,
wrap_app=middleware.ParsableErrorMiddleware,
guess_content_type_from_ext=False
)
if pecan_config.app.enable_acl:

View File

@ -65,6 +65,15 @@ class TestApp(base.TestCase):
os.unlink(tmpfile)
class TestPecanApp(FunctionalTest):
database_connection = tests_db.MongoDBFakeConnectionUrl()
def test_pecan_extension_guessing_unset(self):
# check Pecan does not assume .jpg is an extension
response = self.app.get(self.PATH_PREFIX + '/meters/meter.jpg')
self.assertEqual(response.content_type, 'application/json')
class TestApiMiddleware(FunctionalTest):
# This doesn't really matter