mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2025-05-06 17:51:36 +02:00
Request get_path now has 2 optional parameters for beginning and end slash placements.
This commit is contained in:
parent
1476a89304
commit
28d53b16f4
@ -188,12 +188,20 @@ void Request::setup_url_stack() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String Request::get_path() const {
|
String Request::get_path(const bool beginning_slash, const bool end_slash) const {
|
||||||
String path = "";
|
String path;
|
||||||
|
|
||||||
|
if (beginning_slash) {
|
||||||
|
path += '/';
|
||||||
|
}
|
||||||
|
|
||||||
for (uint32_t i = _path_stack_pointer; i < _path_stack.size(); ++i) {
|
for (uint32_t i = _path_stack_pointer; i < _path_stack.size(); ++i) {
|
||||||
path += _path_stack[i];
|
path += _path_stack[i];
|
||||||
path += "/";
|
path += '/';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!end_slash && path.size() > 1) {
|
||||||
|
path.pop_back();
|
||||||
}
|
}
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
|
@ -67,7 +67,7 @@ public:
|
|||||||
virtual String get_host() const;
|
virtual String get_host() const;
|
||||||
|
|
||||||
void setup_url_stack();
|
void setup_url_stack();
|
||||||
String get_path() const;
|
String get_path(const bool beginning_slash = false, const bool end_slash = true) const;
|
||||||
virtual const String &get_path_full() const;
|
virtual const String &get_path_full() const;
|
||||||
const String &get_path_segment(const uint32_t i) const;
|
const String &get_path_segment(const uint32_t i) const;
|
||||||
const String &get_current_path_segment() const;
|
const String &get_current_path_segment() const;
|
||||||
|
Loading…
Reference in New Issue
Block a user