Malloy
Loading...
Searching...
No Matches
malloy::server::endpoint_http Struct Referenceabstract

#include <endpoint_http.hpp>

Inheritance diagram for malloy::server::endpoint_http:
Collaboration diagram for malloy::server::endpoint_http:

Public Types

template<typename... Bodies>
using response_t = std::variant<malloy::http::response<Bodies>...>
template<typename... Bodies>
using writer_t = std::function<void(const boost::beast::http::request_header<>&, std::variant<malloy::http::response<Bodies>...>&&, const http::connection_t&)>
using handle_retr = std::optional<malloy::http::response<boost::beast::http::string_body>>
using req_header_t = boost::beast::http::request_header<>
using req_t = http::request_generator_t

Public Member Functions

 endpoint_http (const endpoint_http &other)=default
 endpoint_http (endpoint_http &&other) noexcept=default
endpoint_http & operator= (const endpoint_http &rhs)=default
endpoint_http & operator= (endpoint_http &&rhs) noexcept=default
virtual bool matches (const req_header_t &req) const
virtual handle_retr handle (const req_t &req, const http::connection_t &conn) const =0
Public Member Functions inherited from malloy::server::endpoint
 endpoint (const endpoint &other)=default
 endpoint (endpoint &&other) noexcept=default
endpoint & operator= (const endpoint &rhs)=default
endpoint & operator= (endpoint &&rhs) noexcept=default

Public Attributes

malloy::http::method method = malloy::http::method::unknown

Detailed Description

An HTTP endpoint.

Member Function Documentation

◆ handle()

virtual handle_retr malloy::server::endpoint_http::handle ( const req_t & req,
const http::connection_t & conn ) const
nodiscardpure virtual

Handle the request and return the corresponding response.

Parameters
reqThe request.
Returns
The response for the specified request.

Implemented in malloy::server::endpoint_http_files, malloy::server::endpoint_http_redirect, and malloy::server::endpoint_http_regex< Response, Handler, WantsCapture >.

◆ matches()

virtual bool malloy::server::endpoint_http::matches ( const req_header_t & req) const
inlinenodiscardvirtual

Checks whether this endpoint would match the specified request.

The default implementation only checks for the matching method.

Parameters
reqThe request to check.
locationThe location to check for matching.
Returns
Whether this endpoint matches the request.

Reimplemented in malloy::server::endpoint_http_files, malloy::server::endpoint_http_redirect, and malloy::server::endpoint_http_regex< Response, Handler, WantsCapture >.


The documentation for this struct was generated from the following file: