feat(routing): add api to access key segments by name
This commit is contained in:
parent
f652fa08c1
commit
9dbdb0b089
3 changed files with 45 additions and 4 deletions
|
|
@ -28,6 +28,15 @@ void test_routing_simple() {
|
|||
TEST_CHECK(match.key_segments[0].len == 8);
|
||||
TEST_CHECK(match.key_segments[1].start == 15);
|
||||
TEST_CHECK(match.key_segments[1].len == 9);
|
||||
|
||||
lnm_http_route_match_segment *segment;
|
||||
TEST_CHECK(lnm_http_route_match_get(&segment, &match, "second") == lnm_err_ok);
|
||||
TEST_CHECK(segment->start == 15);
|
||||
TEST_CHECK(segment->len == 9);
|
||||
TEST_CHECK(lnm_http_route_match_get(&segment, &match, "yuhh") == lnm_err_not_found);
|
||||
TEST_CHECK(lnm_http_route_match_get(&segment, &match, "hello") == lnm_err_ok);
|
||||
TEST_CHECK(segment->start == 6);
|
||||
TEST_CHECK(segment->len == 8);
|
||||
}
|
||||
|
||||
TEST_LIST = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue