cleanup, docs
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
:title
|
||||
request_query_path
|
||||
|
||||
:sig
|
||||
String request_query_path(Request& context, String default_path = "index")
|
||||
|
||||
:see
|
||||
>uri
|
||||
request_query_route
|
||||
request_context_params
|
||||
route_path_sanitize
|
||||
@@ -18,10 +16,8 @@ For a request such as `/?workspace/projects&theme=dark`, this returns `workspace
|
||||
|
||||
When no keyless route is supplied, the result is `default_path`. When unsafe route input is supplied, the result is an empty string. Unsafe route input includes `.` or `..` segments, empty interior segments, backslashes, dots in filenames, or any character outside ASCII letters, digits, `_`, and `-`.
|
||||
|
||||
```cpp
|
||||
String route_path = request_query_path(context);
|
||||
if(route_path == "")
|
||||
context.set_status(404, "Not Found");
|
||||
```
|
||||
|
||||
The runtime-populated `context.params["ROUTE_PATH"]` uses the same sanitizer.
|
||||
|
||||
:example
|
||||
print(request_query_path(context, "index") != "" ? "path\n" : "empty\n");
|
||||
|
||||
Reference in New Issue
Block a user