Pet project to learn how HTTP servers work internally.
- Setup pipenv environment with
Python3.11 - Install dependencies:
pipenv install
./server.sh {--directory base-directory-name}- Implement new endpoint class in
src/endpoint.py. It should be inherited fromBaseEndpointand implementsEndpointProtocol. - Add new class instance to the
REGISTERED_ENDPOINTS.
- Create new file with the name test_*.sh in the directory
test/e2e/ - Write new test based on the template: GIVE/WHEN/THEN.
- Run tests from the project's root directory:
export TEST_BASE_DIR=$(pwd) && test/e2e/run.sh/(Returns 200 status code).
-
/echo/{message:string}(Returns the message. The message can be encoded ifAccept-Encoding: gzipheader is provided). -
/user-agent(Returns the value ofUser-Agentheader). -
/files/{file-name:string}(Returns file's content if body is empty. Creates new file based on body otherwise).
