27 lines
937 B
C++
27 lines
937 B
C++
#include "View.hpp"
|
|||
|
|
|
||
|
|
namespace molo::example::fw {
|
||
|
|
|
||
|
|
View::View(Request req) : req_(std::move(req)) {}
|
||
|
|
|
||
|
|
Response View::dispatch() {
|
||
|
|
switch (req_.method) {
|
||
|
|
case Method::Get: return get();
|
||
|
|
case Method::Post: return post();
|
||
|
|
case Method::Put: return put();
|
||
|
|
case Method::Patch: return patch();
|
||
|
|
case Method::Delete: return del();
|
||
|
|
case Method::Options: return options();
|
||
|
|
default: return TextResponse("method not allowed", 405);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
Response View::get() { return TextResponse("method not allowed", 405); }
|
||
|
|
Response View::post() { return TextResponse("method not allowed", 405); }
|
||
|
|
Response View::put() { return TextResponse("method not allowed", 405); }
|
||
|
|
Response View::patch() { return TextResponse("method not allowed", 405); }
|
||
|
|
Response View::del() { return TextResponse("method not allowed", 405); }
|
||
|
|
Response View::options() { return TextResponse("method not allowed", 405); }
|
||
|
|
|
||
|
|
} // namespace molo::example::fw
|