drogon
C++14/17-based HTTP application framework
Loading...
Searching...
No Matches
SlashRemover.h
Go to the documentation of this file.
1
13
14#pragma once
15
17#include "drogon/utils/FunctionTraits.h"
18#include <json/value.h>
19
20namespace drogon::plugin
21{
34 "remove_trailing_slashes": true,
35 // If true, it removes all duplicate slashes, e.g.
37 "remove_duplicate_slashes": true,
38 // If true, redirects the request, otherwise forwards
39internally.
40 "redirect": true
41 }
42 }
43 @endcode
44 *
45 * Enable the plugin by adding the configuration to the list of plugins in the
46 * configuration file.
47 * */
48class DROGON_EXPORT SlashRemover : public drogon::Plugin<SlashRemover>
49{
50 public:
51 SlashRemover()
52 {
53 }
54
55 void initAndStart(const Json::Value &config) override;
56 void shutdown() override;
57
58 private:
59 bool trailingSlashes_{true}, duplicateSlashes_{true}, redirect_{true};
60};
61} // namespace drogon::plugin
The reflection base class for plugins.
Definition Plugin.h:132
void initAndStart(const Json::Value &config) override