-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
- Loading branch information
Showing
9 changed files
with
68 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
brew "cmake" | ||
brew "clang-format" | ||
brew "doxygen" | ||
brew "node" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Tests | ||
add_executable(sourcemeta_hydra_http_unit | ||
request_1_1_test.cc) | ||
sourcemeta_hydra_add_compile_options(sourcemeta_hydra_http_unit) | ||
target_compile_definitions(sourcemeta_hydra_http_unit PRIVATE | ||
BASE_URL="http://localhost:9999") | ||
target_link_libraries(sourcemeta_hydra_http_unit | ||
PRIVATE GTest::gtest GTest::gtest_main) | ||
target_link_libraries(sourcemeta_hydra_http_unit | ||
PRIVATE sourcemeta::hydra::http) | ||
set_target_properties(sourcemeta_hydra_http_unit | ||
PROPERTIES FOLDER "Hydra/HTTP") | ||
gtest_discover_tests(sourcemeta_hydra_http_unit) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include <gtest/gtest.h> | ||
#include <sourcemeta/hydra/http.h> | ||
|
||
TEST(HTTP_Request_1_1, XXX) { | ||
sourcemeta::hydra::http::Request request{BASE_URL}; | ||
request.method(sourcemeta::hydra::http::Method::GET); | ||
sourcemeta::hydra::http::Response response{request.send().get()}; | ||
EXPECT_EQ(response.status(), sourcemeta::hydra::http::Status::OK); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const http = require('http'); | ||
|
||
const server = http.createServer((req, res) => { | ||
// Set the response header to indicate JSON content | ||
res.setHeader('Content-Type', 'application/json'); | ||
|
||
// Define a simple JSON response | ||
const jsonResponse = { | ||
message: 'Hello, JSON World!', | ||
timestamp: new Date().toISOString(), | ||
}; | ||
|
||
// Send the JSON response | ||
res.end(JSON.stringify(jsonResponse)); | ||
}); | ||
|
||
const PORT = 9999; | ||
server.listen(PORT, () => { | ||
console.log(`Server is listening on port ${PORT}`); | ||
}); |