Skip to content

Improve test coverage - #45

Merged
RaphiaRa merged 3 commits into
mainfrom
improve-test-coverage
Aug 10, 2026
Merged

Improve test coverage#45
RaphiaRa merged 3 commits into
mainfrom
improve-test-coverage

Conversation

@RaphiaRa

Copy link
Copy Markdown
Owner
  • Improve th_http test coverage and fix arising bugs
  • Improve th_request test coverage and fix arising bugs
  • Some cosmetic change in th_test.c

- th_http_handle_request_and_write_response only set response->code
  on client/server error paths, so success/redirect/informational
  codes returned from a handler were silently dropped in favor of the
  default 200 OK
- add tests covering the TH_HTTP_CODE_TYPE_INFORMATIONAL path
  (including the HTTP/1.0 downgrade-to-400 behavior) and a handler
  returning an unrelated system error mapped through th_http_error
- add src/th_request_test.c covering setters/getters, find/iterate for
  headers, cookies, query/form/path vars and multipart parts, url-decode
  behavior, and reset
- fix th_find_header/th_find_cookie/th_find_queryvar/th_find_formvar/
  th_find_pathvar/th_find_part: strncmp used the stored key's length,
  so a stored key that's a prefix of the search term (e.g. "Ho" vs
  "Host") incorrectly matched; switched to strcmp
@RaphiaRa
RaphiaRa merged commit b7a011a into main Aug 10, 2026
3 checks passed
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 94.00000% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/th_http_test.c 84.21% 0 Missing and 3 partials ⚠️
src/th_request_test.c 97.29% 0 Missing and 2 partials ⚠️
src/th_request.c 83.33% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@RaphiaRa
RaphiaRa deleted the improve-test-coverage branch August 10, 2026 20:03
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