Improve test coverage - #45
Merged
Merged
Conversation
RaphiaRa
commented
Aug 10, 2026
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
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.