Malloy
Loading...
Searching...
No Matches
endpoint_http_redirect.hpp
1#pragma once
2
3#include "endpoint_http.hpp"
4#include "../../core/http/utils.hpp"
5
6namespace malloy::server
7{
8
11 {
12 public:
14 std::string resource_old;
15 std::string resource_new;
16
17
18 [[nodiscard]]
19 bool matches(const req_header_t& head) const override
20 {
21 return malloy::http::resource_string(head) == resource_old;
22 }
23
24 [[nodiscard]]
25 handle_retr handle(const req_t&, const http::connection_t&) const override
26 {
27 return malloy::http::generator::redirect(status, resource_new);
28 }
29
30 };
31
32}
static response redirect(status code, std::string_view location)
Definition: generator.cpp:17
boost::beast::http::status status
Definition: types.hpp:23
Definition: endpoint_http_redirect.hpp:11
handle_retr handle(const req_t &, const http::connection_t &) const override
Definition: endpoint_http_redirect.hpp:25
bool matches(const req_header_t &head) const override
Definition: endpoint_http_redirect.hpp:19
Definition: endpoint_http.hpp:22