コード例 #1
0
    def test_on_headers_complete_passes_request(self):
        global request, on_head_got_request, on_body_got_request

        pipeline = HttpFilterPipeline()
        pipeline.add_filter(ResponseFilterUsesRequest())
        pipeline.add_filter(ResponseFilterDoesNotUseRequest())

        downstream = mock.MagicMock()
        downstream.write = mock.Mock(return_value=None)

        upstream = mock.MagicMock()
        request = mock.Mock()

        handler = UpstreamHandler(downstream, upstream, pipeline, request)
        handler.on_status(200)  # Make response non-empty to prevent errors
        handler.on_headers_complete()
        handler.on_body(bytes="", length=0, is_chunked=False)

        self.assertTrue(on_head_got_request)
        self.assertTrue(on_body_got_request)
コード例 #2
0
    def test_on_headers_complete_passes_request(self):
        global request, on_head_got_request, on_body_got_request

        pipeline = HttpFilterPipeline()
        pipeline.add_filter(ResponseFilterUsesRequest())
        pipeline.add_filter(ResponseFilterDoesNotUseRequest())

        downstream = mock.MagicMock()
        downstream.write = mock.Mock(return_value=None)

        upstream = mock.MagicMock()
        request = mock.Mock()

        handler = UpstreamHandler(downstream, upstream, pipeline, request)
        handler.on_status(200)  # Make response non-empty to prevent errors
        handler.on_headers_complete()
        handler.on_body(bytes='', length=0, is_chunked=False)

        self.assertTrue(on_head_got_request)
        self.assertTrue(on_body_got_request)
コード例 #3
0
ファイル: daemon.py プロジェクト: akatrevorjay/pyrox
 def new_filter_pipeline():
     pipeline = HttpFilterPipeline()
     for cls in filter_classes:
         pipeline.add_filter(filter_instances[cls.__name__])
     return pipeline
コード例 #4
0
ファイル: daemon.py プロジェクト: akatrevorjay/pyrox
 def new_filter_pipeline():
     pipeline = HttpFilterPipeline()
     for cls in filter_cls_list:
         pipeline.add_filter(cls())
     return pipeline
コード例 #5
0
ファイル: daemon.py プロジェクト: akatrevorjay/pyrox
 def new_filter_pipeline():
     pipeline = HttpFilterPipeline()
     for cls in filter_classes:
         pipeline.add_filter(filter_instances[cls.__name__])
     return pipeline
コード例 #6
0
ファイル: daemon.py プロジェクト: akatrevorjay/pyrox
 def new_filter_pipeline():
     pipeline = HttpFilterPipeline()
     for cls in filter_cls_list:
         pipeline.add_filter(cls())
     return pipeline