File tree Expand file tree Collapse file tree 5 files changed +32
-0
lines changed Expand file tree Collapse file tree 5 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -72,6 +72,11 @@ endif()
72
72
if (HYDRA_TESTS )
73
73
find_package (GoogleTest REQUIRED )
74
74
enable_testing ()
75
+
76
+ if (HYDRA_HTTP )
77
+ add_subdirectory (test /http )
78
+ endif ()
79
+
75
80
# TODO: Add tests
76
81
if (PROJECT_IS_TOP_LEVEL )
77
82
# Otherwise we need the child project to link
Original file line number Diff line number Diff line change
1
+ include (GoogleTest )
1
2
set (BUILD_GMOCK OFF CACHE BOOL "disable googlemock" )
2
3
set (INSTALL_GTEST OFF CACHE BOOL "disable installation" )
3
4
add_subdirectory ("${PROJECT_SOURCE_DIR} /vendor/googletest" )
Original file line number Diff line number Diff line change
1
+ add_executable (sourcemeta_hydra_http_unit
2
+ http_1_1_test.cc )
3
+ sourcemeta_hydra_add_compile_options (sourcemeta_hydra_http_unit )
4
+ target_link_libraries (sourcemeta_hydra_http_unit
5
+ PRIVATE GTest::gtest GTest::gtest_main )
6
+ target_link_libraries (sourcemeta_hydra_http_unit
7
+ PRIVATE sourcemeta::hydra::http )
8
+ set_target_properties (sourcemeta_hydra_http_unit
9
+ PROPERTIES FOLDER "Hydra/HTTP" )
10
+ gtest_discover_tests (sourcemeta_hydra_http_unit )
Original file line number Diff line number Diff line change
1
+ #include < gtest/gtest.h>
2
+ #include < sourcemeta/hydra/http.h>
3
+
4
+ TEST (Hydra_HTTP_1_1, XXX) { EXPECT_TRUE (true ); }
Original file line number Diff line number Diff line change
1
+ const port = 8080 ;
2
+
3
+ const handler = ( request : Request ) : Response => {
4
+ const body = `Your user-agent is:\n\n${
5
+ request . headers . get ( "user-agent" ) ?? "Unknown"
6
+ } `;
7
+
8
+ return new Response ( body , { status : 200 } ) ;
9
+ } ;
10
+
11
+ console . log ( `HTTP server running. Access it at: http://localhost:8080/` ) ;
12
+ Deno . serve ( { port } , handler ) ;
You can’t perform that action at this time.
0 commit comments