Example #1
0
 def __init__(self, client_response):
     self.client_response = client_response
     self.parser = HttpParser()
     self.server = AttributeDictionary(
         server_name="local-testing-server",
         server_port=8888,
         app_handler=client_response.request.client.wsgi_handler,
     )
     for d in client_response.request_data:
         self.parser.execute(d, len(d))
Example #2
0
class DummyHttpServerConnection(IStream):
    """This is a simple class simulating a connection on
a Http server. It contains the client response so that the
write method simply write on the client response
object."""

    def __init__(self, client_response):
        self.client_response = client_response
        self.parser = HttpParser()
        self.server = AttributeDictionary(
            server_name="local-testing-server",
            server_port=8888,
            app_handler=client_response.request.client.wsgi_handler,
        )
        for d in client_response.request_data:
            self.parser.execute(d, len(d))

    def write(self, response):
        for data in response:
            if data:
                self.client_response.parsedata(data)
Example #3
0
 def parser(self, kind=0):
     return HttpParser(kind=kind)