This is a finished Python implementation for the "Build Your Own HTTP server" Challenge. This code implements functionality for all stages (and extensions) of the challenge as of 2025-02-13.
- Respond to a
GETrequest made to/echo/{string}with a body of{string}. - Respond to a
GETrequest made to/user-agentwith a body containing your user-agent. - Return a file when a
GETrequest is made to/files/{filename}given the server is started with the command line option--directory <dir>and{filename}is present in the<dir>. - Write a file
{filename}to<dir>when aPOSTrequest is made to/files/{filename}and--directory <dir>is provided on the command line. - Respond with a
gzipencoded body when the client'sAccept-Encodingheader containsgzip.
- Refactor code to be more pythonic.
- Restructure the project into a codebase that is simple to maintain and extend (demonstrate how I approach software engineering versus just slinging code).
A short video of the code being run in the codecrafters test environment: