This HTTP server establishes a connection with the client using a low-level socket library. It was built according to SOLID principles and using a test-driven development approach.
No external dependencies have been incorporated, apart from those used for linting and testing purposes.
The following routes and methods are currently supported:
| URI | Methods Allowed | Response Headers | Response Body? |
|---|---|---|---|
| /simple_get | GET, HEAD | none | No |
| /simple_get_with_body | GET, HEAD | Content-Length | Yes (GET) |
| /head_request | HEAD | Allow | No |
| /echo_body | POST | Content-Length | Yes (POST) |
| /redirect | GET, HEAD | Location | No |
| /method_options | GET, HEAD, OPTIONS | Allow | No |
| /method_options2 | GET, HEAD, OPTIONS, POST, PUT | Allow | No |
| /health-check.html | GET, HEAD | Content-Length, Content-Type |
Yes (GET) |
| /kitteh.jpg | GET, HEAD | Content-Length, Content-Type |
Yes (GET) |
| /doggo.png | GET, HEAD | Content-Length, Content-Type |
Yes (GET) |
| /kisses.gif | GET, HEAD | Content-Length, Content-Type |
Yes (GET) |
The production server is located at [tbd]. Please see instructions below for guidance on installing and running the server locally on your own machine.
Clone this repo from the terminal:
git clone https://github.com/fifikim/http-server.git
Navigate to program root directory:
cd http-server
Build the project:
./gradlew build
Next, build the acceptance test suite. Navigate to its directory:
cd http-server-spec
Install dependencies:
bundle install
Automated linting and testing has been incorporated into the build process. However, each of these tasks may also be run individually if desired:
Run the linter for source code:
./gradlew checkstyleMain
Run the linter for the test suite:
./gradlew checkstyleTest
There are separate test suites for unit tests and acceptance tests.
Run unit tests from the project's root directory:
./gradlew test
Before running the acceptance tests, start the HTTP Server on port 5000. From a separate terminal, navigate to the directory containing acceptance tests:
cd http-server-spec
Then run:
rake test
java -jar build/libs/http-server.jar
tbd