

def test_respond(self):
    response = self.request('/response')
    self.assertEqual(response.headers['Content-Type'], 'application/json; charset=UTF-8')
    self.assertEqual(self.body, b'{"hello": "world"}')
    response = self.request('/response?callback=foo')
    self.assertEqual(response.headers['Content-Type'], 'application/javascript; charset=UTF-8')
    self.assertEqual(response.body, b'foo({"hello": "world"})')
    response = self.request('/response?callback=!!!')
    self.assertEqual(response.headers['Content-Type'], 'application/json; charset=UTF-8')
    self.assertTrue((b'Invalid callback identifier' in response.body))

dataset/ETHPy150Open dailymuse/oz/oz/json_api/tests/test_middleware.py ApiMiddlewareTestCase.test_respond/VarMisuse@37/59 `response`->`self`