diff --git a/router.c b/router.c index 997b41d..ad2a199 100644 --- a/router.c +++ b/router.c @@ -260,9 +260,13 @@ router_find_endpoint(const char *uri_str, size_t uri_len, struct mg_str *method_ 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; } 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; 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].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; + endpoints[i].possible_route += 3; continue; } endpoints[i].possible_route = 0;