Skip to content

Conversation

@etr
Copy link
Owner

@etr etr commented Jan 31, 2026

Summary

  • Add HEAD, OPTIONS, TRACE method handlers to complete_test_resource
  • Add integration tests for HEAD, OPTIONS, TRACE HTTP methods
  • Add request_info_resource and test for get_requestor(), get_requestor_port(), get_version()
  • Add content_limit_suite to test content_too_large() with content_size_limit
  • Add unregister_then_404 test for webserver::unregister_resource()
  • Create http_response unit test file with tests for response code, headers, footers, and cookies

Test plan

  • All existing tests pass (make check shows 13/13 pass)
  • New basic tests pass (52 tests, 220 checks)
  • New http_response unit tests pass (9 tests, 12 checks)

Coverage improvements

These tests exercise previously untested code paths in:

  • src/webserver.cpp (HEAD/OPTIONS/TRACE method dispatch, unregister_resource)
  • src/http_request.cpp (get_requestor, get_requestor_port, get_version, content_too_large)
  • src/http_response.cpp (footer/cookie getters, response code)

- Add HEAD, OPTIONS, TRACE method handlers to complete_test_resource
- Add integration tests for HEAD, OPTIONS, TRACE HTTP methods
- Add request_info_resource and test for get_requestor(), get_requestor_port(), get_version()
- Add content_limit_suite to test content_too_large() with content_size_limit
- Add unregister_then_404 test for webserver::unregister_resource()
- Create http_response unit test file with tests for response code, headers, footers, and cookies

These tests increase coverage for previously untested code paths in
webserver.cpp, http_request.cpp, and http_response.cpp.
@codecov
Copy link

codecov bot commented Jan 31, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.59%. Comparing base (77b089a) to head (3668ad1).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #362      +/-   ##
==========================================
+ Coverage   61.98%   69.59%   +7.61%     
==========================================
  Files          28       28              
  Lines        1339     1421      +82     
  Branches      562      564       +2     
==========================================
+ Hits          830      989     +159     
+ Misses        126       53      -73     
+ Partials      383      379       -4     

see 14 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 77b089a...3668ad1. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

etr added 4 commits January 31, 2026 00:03
- Add IPv6 and dual-stack webserver tests
- Add HTTPS webserver and TLS session getter tests with graceful failure handling
- Add bind_address_ipv4 test with runtime URL building
- Add shoutcast response test for MHD_ICY_FLAG verification
- Add string_response constructor tests
- Remove CONNECT method test (incompatible with curl's tunneling semantics)

Coverage improved from ~90% to 91.8% lines, 93.3% functions.
Add --print-summary flag to gcovr command in CI to help diagnose
the discrepancy between local coverage (91.8%) and Codecov (64.53%).
The coverage report was including 15,781 lines from system headers and
dependencies instead of just the ~1,500 lines of libhttpserver source.
Use --filter to restrict coverage to src/ directory only.
- Add footer/trailer tests for http_request and http_response
- Add PSK handler configuration tests (setup, empty handler, no handler)
- Add ban/allow IP weight comparison tests for specific-then-wildcard case
- Add auth skip path tests for root path and wildcards
- Add IPv6 parsing edge case tests (too many parts, wildcards, nested)
- Add http_endpoint invalid regex pattern test
- Add custom error handler tests (not_found, method_not_allowed)
- Add request info caching tests

Branch coverage: 60.4% -> 64.2% (+65 branches)
Line coverage: 91.8% -> 94.9%
@etr etr force-pushed the feature/increase-test-coverage branch from 50ad76c to 822ab69 Compare January 31, 2026 23:33
etr added 3 commits February 1, 2026 01:05
- Add null value query parameter test covering nullptr branches in
  build_request_args and build_request_querystring (lines 234, 248)
- Add digested user caching tests for cache hit and nullptr branches
  (lines 293-295, 300) in http_request.cpp
- Add caret prefix URL pattern tests covering line 85 in http_endpoint.cpp
- Add consecutive slashes URL test covering empty parts handling (line 83)

Branch coverage improvements:
- http_endpoint.cpp: 66.9% -> 68.7%
- http_request.cpp: 58.5% -> 59.7%
- Add tests for all HTTP methods falling through to base render()
- Add custom internal error resource handler test
- Add get_arg_flat fallback test
- Add large multipart form field test (100KB)
- Add file upload with explicit content-type header test
- Add http_endpoint tests for regex validation and error paths
- Add tests for invalid URL parameter formats
- Replace static global strings with function-static pattern
- Change 'long' to 'int64_t' for http_code variables
- Add missing #include <utility> for std::move
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants