High-Level Transformations
To save you the trouble of typing it, here's the request we used in the video.
And here's the expected response:
Finally here are the three high-level transformations we used as a starting point.
To save you the trouble of typing it, here's the request we used in the video.
request = """
GET /wildthings HTTP/1.1
Host: example.com
User-Agent: ExampleBrowser/1.0
Accept: */*
"""
And here's the expected response:
expected_response = """
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 20
Bears, Lions, Tigers
"""
Finally here are the three high-level transformations we used as a starting point.
def parse(request) do
# TODO: Parse the request string into a map:
conv = %{ method: "GET", path: "/wildthings", resp_body: "" }
end
def route(conv) do
# TODO: Create a new map that also has the response body:
conv = %{ method: "GET", path: "/wildthings", resp_body: "Bears, Lions, Tigers" }
end
def format_response(conv) do
# TODO: Use values in the map to create an HTTP response string:
"""
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 20
Bears, Lions, Tigers
"""
end