Skip to content

Conversation

@ReenigneArcher
Copy link
Member

@ReenigneArcher ReenigneArcher commented Jan 30, 2026

Description

Consolidated multiple individual HTML page handler functions into a single getPage function that serves different HTML files based on parameters. Updated server route bindings to use the new generic handler, reducing code duplication and improving maintainability.

Updated all HTTP handler functions to take const reference parameters for response and request objects, improving const-correctness and clarity. Introduced a helper for page handlers and refactored server route setup to use concise lambda expressions and handler typedefs, reducing code duplication and improving maintainability.

Introduced check_request_body_empty to validate that certain API endpoints receive no request body, replacing previous content-type checks where appropriate.

Refactors the generateExamples javascript function for docs to only include Content-Type headers and body parameters in cURL, JavaScript, and PowerShell examples when a request body is present. This prevents unnecessary headers and parameters in generated code samples for endpoints that do not require a body.

Screenshot

Issues Fixed or Closed

Roadmap Issues

Type of Change

  • feat: New feature (non-breaking change which adds functionality)
  • fix: Bug fix (non-breaking change which fixes an issue)
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semicolons, etc.)
  • refactor: Code change that neither fixes a bug nor adds a feature
  • perf: Code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • build: Changes that affect the build system or external dependencies
  • ci: Changes to CI configuration files and scripts
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit
  • BREAKING CHANGE: Introduces a breaking change (can be combined with any type above)

Checklist

  • Code follows the style guidelines of this project
  • Code has been self-reviewed
  • Code has been commented, particularly in hard-to-understand areas
  • Code docstring/documentation-blocks for new or existing methods/components have been added or updated
  • Unit tests have been added or updated for any new or modified functionality

AI Usage

  • None: No AI tools were used in creating this PR
  • Light: AI provided minor assistance (formatting, simple suggestions)
  • Moderate: AI helped with code generation or debugging specific parts
  • Heavy: AI generated most or all of the code changes

@codecov
Copy link

codecov bot commented Jan 30, 2026

Bundle Report

Bundle size has no change ✅

@codecov
Copy link

codecov bot commented Jan 30, 2026

Codecov Report

❌ Patch coverage is 0% with 110 lines in your changes missing coverage. Please review.
✅ Project coverage is 15.50%. Comparing base (3ce39b3) to head (edee013).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/confighttp.cpp 0.00% 108 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4645      +/-   ##
==========================================
- Coverage   15.51%   15.50%   -0.02%     
==========================================
  Files          94       94              
  Lines       19248    19186      -62     
  Branches     8907     8861      -46     
==========================================
- Hits         2986     2974      -12     
- Misses      14393    14995     +602     
+ Partials     1869     1217     -652     
Flag Coverage Δ
Archlinux 11.67% <0.00%> (+0.06%) ⬆️
FreeBSD-14.3-aarch64 ?
FreeBSD-14.3-amd64 13.82% <0.00%> (+0.07%) ⬆️
Homebrew-ubuntu-22.04 13.99% <0.00%> (+0.08%) ⬆️
Linux-AppImage 12.00% <0.00%> (+0.06%) ⬆️
Windows-AMD64 13.56% <0.00%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/confighttp.cpp 0.00% <0.00%> (ø)

... and 24 files with indirect coverage changes

@ReenigneArcher ReenigneArcher force-pushed the refactor/confighttp/common-functions branch 2 times, most recently from edee013 to 1f0d6d4 Compare January 30, 2026 21:42
Consolidated multiple individual HTML page handler functions into a single getPage function that serves different HTML files based on parameters. Updated server route bindings to use the new generic handler, reducing code duplication and improving maintainability.
Updated all HTTP handler functions to take const reference parameters for response and request objects, improving const-correctness and clarity. Introduced a helper for page handlers and refactored server route setup to use concise lambda expressions and handler typedefs, reducing code duplication and improving maintainability.
Introduced check_request_body_empty to validate that certain API endpoints receive no request body, replacing previous content-type checks where appropriate. This improves request validation and ensures correct client usage for endpoints that do not expect a body.
Updated function signatures in confighttp.cpp to ensure consistent spacing between type and parameter names, improving code readability and style consistency.
Refactors the generateExamples function to only include Content-Type headers and body parameters in cURL, JavaScript, and PowerShell examples when a request body is present. This prevents unnecessary headers and parameters in generated code samples for endpoints that do not require a body.
Add initial unit tests for confighttp using a real HTTPS client/server (tests/unit/test_confighttp.cpp). Update confighttp public API and types: add necessary includes (nlohmann::json, Simple-Web-Server), introduce HTTPS type aliases (https_server_t, resp_https_t, req_https_t), and declare helper functions (print_req, send_response, send_unauthorized, send_redirect, authenticate, not_found, bad_request, check_* utilities, getPage, etc.). Align implementations in src/confighttp.cpp with the header by removing default parameters from not_found, bad_request, and getPage signatures. These changes improve test coverage and clarify the confighttp interface.
@ReenigneArcher ReenigneArcher force-pushed the refactor/confighttp/common-functions branch from 1f0d6d4 to 691ff1b Compare January 31, 2026 00:36
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
12 New issues
1 Security Hotspot
6.1% Duplication on New Code (required ≤ 2%)
12 New Code Smells (required ≤ 0)
2 Duplicated Blocks on New Code (required ≤ 0)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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