Lesson 5: Constructing and using Responses

  • The new server
  • Exercise 1: Construct a response
  • Response-constructing functions
  • Exercise 2: Use the functions
  • 5 minutes

In lesson 4, we wrote a function for encoding our abstract representation of a Response as a byte string suitable for transmission over a network according to the HTTP protocol.

Now we can rewrite our server so that the HTTP response it sends is constructed from a value of the Response type.

Sign up for access to the full page, plus the complete archive and all the latest content.