tests/dispatch/utils.py
def stream_complete(self, stream_id):
        """
        Handler for when the HTTP request is completed.
        """
        request = self.requests[stream_id].pop(0)
        if not self.requests[stream_id]:
            del self.requests[stream_id]

        headers_dict = dict(request["headers"])

        method = headers_dict[b":method"].decode("ascii")
        url = "%s://%s%s" % (
            headers_dict[b":scheme"].decode("ascii"),
            headers_dict[b":authority"].decode("ascii"),
            headers_dict[b":path"].decode("ascii"),
        )
        headers = [(k, v) for k, v in request["headers"] if not k.startswith(b":")]
        data = request["data"]

        # Call out to the app.
        request = Request(method, url, headers=headers, data=data)
        response = self.app(request)

        # Write the response to the buffer.
        status_code_bytes = str(response.status_code).encode("ascii")
        response_headers = [(b":status", status_code_bytes)] + response.headers.raw

        self.conn.send_headers(stream_id, response_headers)
        self.conn.send_data(stream_id, response.content, end_stream=True)
        self.buffer += self.conn.data_to_send()

        Handler for when the HTTP request is completed.
        
Handler for when the HTTP request is completed.
Handler for when the HTTP request is completed .
def stream_complete(self, stream_id):
        request = self.requests[stream_id].pop(0)
        if not self.requests[stream_id]:
            del self.requests[stream_id]
        headers_dict = dict(request["headers"])
        method = headers_dict[b":method"].decode("ascii")
        url = "%s://%s%s" % (
            headers_dict[b":scheme"].decode("ascii"),
            headers_dict[b":authority"].decode("ascii"),
            headers_dict[b":path"].decode("ascii"),
        )
        headers = [(k, v) for k, v in request["headers"] if not k.startswith(b":")]
        data = request["data"]
        request = Request(method, url, headers=headers, data=data)
        response = self.app(request)
        status_code_bytes = str(response.status_code).encode("ascii")
        response_headers = [(b":status", status_code_bytes)] + response.headers.raw
        self.conn.send_headers(stream_id, response_headers)
        self.conn.send_data(stream_id, response.content, end_stream=True)
        self.buffer += self.conn.data_to_send()
def stream_complete ( self , stream_id ) : request = self . requests [ stream_id ] . pop ( 0 ) if not self . requests [ stream_id ] : del self . requests [ stream_id ] headers_dict = dict ( request [ "headers" ] ) method = headers_dict [ b":method" ] . decode ( "ascii" ) url = "%s://%s%s" % ( headers_dict [ b":scheme" ] . decode ( "ascii" ) , headers_dict [ b":authority" ] . decode ( "ascii" ) , headers_dict [ b":path" ] . decode ( "ascii" ) , ) headers = [ ( k , v ) for k , v in request [ "headers" ] if not k . startswith ( b":" ) ] data = request [ "data" ] request = Request ( method , url , headers = headers , data = data ) response = self . app ( request ) status_code_bytes = str ( response . status_code ) . encode ( "ascii" ) response_headers = [ ( b":status" , status_code_bytes ) ] + response . headers . raw self . conn . send_headers ( stream_id , response_headers ) self . conn . send_data ( stream_id , response . content , end_stream = True ) self . buffer += self . conn . data_to_send ( )
Handler for when the HTTP request is completed.
Handler for when the HTTP request is completed .
"""
        Handler for when the HTTP request is completed.
        """ # Call out to the app. # Write the response to the buffer.
self
stream_id