Skip to content

Commit

Permalink
Add assertions for header count in HTTP request tests
Browse files Browse the repository at this point in the history
This commit adds assertions to check the number of headers in HTTP request objects. This ensures that the header count is verified for better test accuracy and completeness.
  • Loading branch information
SeriousSamV committed Oct 31, 2024
1 parent 2895636 commit 22fc78c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/assert_tiny_http_server_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ void test_request_post_root_curl(void) {
assert(http_req->method == POST);
assert(http_req->version == HTTP_1_0);
assert(strncmp(http_req->url, "/one/two/three", 255) == 0);
assert(http_req->headers_cnt == 6);
assert(strncmp(http_req->headers[0]->name, "Content-Type", 255) == 0);
assert(strncmp(http_req->headers[0]->value, "application/json", 255) == 0);
assert(strncmp(http_req->headers[1]->name, "User-Agent", 255) == 0);
Expand Down Expand Up @@ -87,6 +88,7 @@ void test_request_post_root_curl_with_wide_chars(void) {
assert(http_req->method == POST);
assert(http_req->version == HTTP_1_0);
assert(strncmp(http_req->url, "/one/🐌/three", 255) == 0);
assert(http_req->headers_cnt == 7);
assert(strncmp(http_req->headers[0]->name, "Content-Type", 255) == 0);
assert(strncmp(http_req->headers[0]->value, "application/json", 255) == 0);
assert(strncmp(http_req->headers[1]->name, "User-Agent", 255) == 0);
Expand Down

0 comments on commit 22fc78c

Please sign in to comment.