fix: handling of {str} or {int} in request
This commit is contained in:
parent
420bdeb2aa
commit
c370ab6fea
1 changed files with 8 additions and 8 deletions
16
router.c
16
router.c
|
@ -260,9 +260,13 @@ router_find_endpoint(const char *uri_str, size_t uri_len, struct mg_str *method_
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strcmp(endpoints[i].route[route_part], uri_token) == 0)
|
if(strcmp(endpoints[i].route[route_part], "{str}") == 0)
|
||||||
{
|
{
|
||||||
endpoints[i].possible_route += 3;
|
endpoints[i].possible_route += 1;
|
||||||
|
|
||||||
|
endpoints[i].args[endpoints[i].args_found].type = ENDPOINT_ARG_TYPE_STR;
|
||||||
|
endpoints[i].args[endpoints[i].args_found].value.v_str = uri_token;
|
||||||
|
++endpoints[i].args_found;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(strcmp(endpoints[i].route[route_part], "{int}") == 0)
|
if(strcmp(endpoints[i].route[route_part], "{int}") == 0)
|
||||||
|
@ -282,13 +286,9 @@ router_find_endpoint(const char *uri_str, size_t uri_len, struct mg_str *method_
|
||||||
++endpoints[i].args_found;
|
++endpoints[i].args_found;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(strcmp(endpoints[i].route[route_part], "{str}") == 0)
|
if(strcmp(endpoints[i].route[route_part], uri_token) == 0)
|
||||||
{
|
{
|
||||||
endpoints[i].possible_route += 1;
|
endpoints[i].possible_route += 3;
|
||||||
|
|
||||||
endpoints[i].args[endpoints[i].args_found].type = ENDPOINT_ARG_TYPE_STR;
|
|
||||||
endpoints[i].args[endpoints[i].args_found].value.v_str = uri_token;
|
|
||||||
++endpoints[i].args_found;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
endpoints[i].possible_route = 0;
|
endpoints[i].possible_route = 0;
|
||||||
|
|
Loading…
Reference in a new issue