This commit is contained in:
@@ -50,7 +50,6 @@ bool found_route(restd_server_t *server, const char *method, const char *path)
|
||||
if (hook->path && path && strcmp(hook->path, path) == 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -66,6 +65,7 @@ bool contain (const char *src, const char *dest, int len)
|
||||
len_src = strlen(src);
|
||||
if (len_src < len)
|
||||
return false;
|
||||
|
||||
len_dest = strlen(dest);
|
||||
if (len_dest < len)
|
||||
return false;
|
||||
@@ -103,19 +103,19 @@ bool found_special_route(restd_server_t *server, const char *method, const char
|
||||
pos = i;
|
||||
i++;
|
||||
}
|
||||
printf("pos: %d\n", pos);
|
||||
printf("contain: %s\n", contain(hook->path, path, pos)?"TRUE":"FALSE");
|
||||
// printf("hook path: %s, path: %s\n", hook->path, path);
|
||||
// printf("pos: %d\n", pos);
|
||||
// printf("contain: %s\n", contain(hook->path, path, pos) ? "TRUE" : "FALSE");
|
||||
if (pos != -1 && contain(hook->path, path, pos))
|
||||
{
|
||||
const char *buffer = &path[i];
|
||||
printf("buffer: %s\n", buffer);
|
||||
const char *buffer = &path[pos];
|
||||
// printf("buffer: <%s>\n", buffer);
|
||||
*id = atoi(buffer);
|
||||
return true;
|
||||
}
|
||||
else if (strcmp(hook->path, path) == 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ TEST("Rest - create access regular route free\t")
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
TEST("Rest - create access regex route free\t")
|
||||
TEST("Rest - create access route with param free\t")
|
||||
{
|
||||
restd_server_t *rest_server;
|
||||
int id = 0;
|
||||
|
||||
Reference in New Issue
Block a user