High-Level Transformations
Paste It In
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
All course material, including videos, slides, and source code, is copyrighted and licensed for individual use only. You may make copies for your own personal use (e.g. on your laptop, on your iPad, on your backup drive). However, you may not transfer ownership or share the material with other people. We make no guarantees that the source code is fit for any purpose. Course material may not be used to create training material, courses, books, and the like. Please support us by encouraging others to purchase their own copies. Thank you!
Copyright © 2005–2021, The Pragmatic Studio. All Rights Reserved.