Loading bridgedb/distributors/moat/server.py +8 −8 Original line number Diff line number Diff line Loading @@ -178,11 +178,11 @@ class JsonAPIResource(resource.Resource): :param request: A ``Request`` for a :api:`twisted.web.resource.Resource`. :returns: The encoded data. """ request.responseHeaders.addRawHeader(b"Content-Type", b"application/vnd.api+json") request.responseHeaders.addRawHeader(b"Server", b"moat/%s" % MOAT_API_VERSION.encode('utf-8')) request.responseHeaders.addRawHeader("Content-Type", "application/vnd.api+json") request.responseHeaders.addRawHeader("Server", "moat/%s" % MOAT_API_VERSION) if data: rendered = json.dumps(data) rendered = json.dumps(data).encode("utf-8") else: rendered = b"" Loading Loading @@ -824,13 +824,13 @@ def addMoatServer(config, distributor): hmacKey, publicKey, secretKey, fwdHeaders, skipLoopback) moat.putChild("fetch", fetch) moat.putChild("check", check) meek.putChild("moat", moat) moat.putChild(b"fetch", fetch) moat.putChild(b"check", check) meek.putChild(b"moat", moat) root = CustomErrorHandlingResource() root.putChild("meek", meek) root.putChild("moat", moat) root.putChild(b"meek", meek) root.putChild(b"moat", moat) site = Site(root) site.displayTracebacks = False Loading bridgedb/test/test_distributors_moat_server.py +2 −2 Original line number Diff line number Diff line Loading @@ -884,7 +884,7 @@ class CaptchaCheckResourceTests(unittest.TestCase): response = self.resource.failureResponse(6, request, bridgeRequest) self.assertIn("No bridges available", response) self.assertIn(b"No bridges available", response) def test_render_POST_no_bridges(self): self.mock_getBridgeLines() Loading @@ -892,7 +892,7 @@ class CaptchaCheckResourceTests(unittest.TestCase): request = self.create_valid_POST_make_new_challenge() response = self.resource.render(request) self.assertIn("No bridges available", response) self.assertIn(b"No bridges available", response) def test_render_POST_unexpired(self): request = self.create_valid_POST_make_new_challenge() Loading Loading
bridgedb/distributors/moat/server.py +8 −8 Original line number Diff line number Diff line Loading @@ -178,11 +178,11 @@ class JsonAPIResource(resource.Resource): :param request: A ``Request`` for a :api:`twisted.web.resource.Resource`. :returns: The encoded data. """ request.responseHeaders.addRawHeader(b"Content-Type", b"application/vnd.api+json") request.responseHeaders.addRawHeader(b"Server", b"moat/%s" % MOAT_API_VERSION.encode('utf-8')) request.responseHeaders.addRawHeader("Content-Type", "application/vnd.api+json") request.responseHeaders.addRawHeader("Server", "moat/%s" % MOAT_API_VERSION) if data: rendered = json.dumps(data) rendered = json.dumps(data).encode("utf-8") else: rendered = b"" Loading Loading @@ -824,13 +824,13 @@ def addMoatServer(config, distributor): hmacKey, publicKey, secretKey, fwdHeaders, skipLoopback) moat.putChild("fetch", fetch) moat.putChild("check", check) meek.putChild("moat", moat) moat.putChild(b"fetch", fetch) moat.putChild(b"check", check) meek.putChild(b"moat", moat) root = CustomErrorHandlingResource() root.putChild("meek", meek) root.putChild("moat", moat) root.putChild(b"meek", meek) root.putChild(b"moat", moat) site = Site(root) site.displayTracebacks = False Loading
bridgedb/test/test_distributors_moat_server.py +2 −2 Original line number Diff line number Diff line Loading @@ -884,7 +884,7 @@ class CaptchaCheckResourceTests(unittest.TestCase): response = self.resource.failureResponse(6, request, bridgeRequest) self.assertIn("No bridges available", response) self.assertIn(b"No bridges available", response) def test_render_POST_no_bridges(self): self.mock_getBridgeLines() Loading @@ -892,7 +892,7 @@ class CaptchaCheckResourceTests(unittest.TestCase): request = self.create_valid_POST_make_new_challenge() response = self.resource.render(request) self.assertIn("No bridges available", response) self.assertIn(b"No bridges available", response) def test_render_POST_unexpired(self): request = self.create_valid_POST_make_new_challenge() Loading