Index: turbogears/tests/test_controllers.py
===================================================================
--- turbogears/tests/test_controllers.py	(revision 1127)
+++ turbogears/tests/test_controllers.py	(working copy)
@@ -458,3 +458,44 @@
     testutil.createRequest("/foo")
     print cherrypy.response.status
     assert cherrypy.response.status.startswith("302")
+
+class TextExpose(unittest.TestCase):
+    class Controller(controllers.RootController):
+        def outer_json(self):
+            return dict()
+        outer_json = turbogears.expose(
+                                "turbogears.tests.othertemplate")(outer_json)
+        outer_json = turbogears.expose("json")(outer_json)
+
+        def inner_json(self):
+            return dict()
+        inner_json = turbogears.expose("json")(inner_json)
+        inner_json = turbogears.expose(
+                                "turbogears.tests.othertemplate")(inner_json)
+
+        
+    def setUp(self):
+        cherrypy.tree.mount_points = {}
+        cherrypy.root = self.Controller()
+
+    def test_inner_json(self):
+        testutil.create_request("/inner_json")
+        content_type = cherrypy.response.headers["Content-Type"]
+        print content_type
+        assert "text/html" in content_type.lower()
+
+        testutil.create_request("/inner_json?tg_format=json")
+        content_type = cherrypy.response.headers["Content-Type"]
+        print content_type
+        assert "text/javascript" in content_type.lower()
+
+    def test_outer_json(self):
+        testutil.create_request("/outer_json")
+        content_type = cherrypy.response.headers["Content-Type"]
+        print content_type
+        assert "text/html" in content_type.lower()
+
+        testutil.create_request("/outer_json?tg_format=json")
+        content_type = cherrypy.response.headers["Content-Type"]
+        print content_type
+        assert "text/javascript" in content_type.lower()

