Example #1
0
    def testMakingRequests(self):

        self.assertEqual(
            makeRequest(
                "POST", "/", "HTTP/1.0",
                (
                    ("Content-type", "text/plain"),
                    ("User-agent", "test")
                ),
                "A"
            ),
            "\r\n".join((
                "POST / HTTP/1.0",
                "Content-type: text/plain",
                "User-agent: test",
                "",
                "A"
            ))
        )
Example #2
0
File: util.py Project: xmnr/atk
def composeRequest(d, lb=linebreak):
    """
    Compose a message from a dictionary as returned by parseRequest.
    """

    return makeRequest(d["method"], d["path"], d["version"], d["headers"], d["entity"], lb)