Thoth
A functional, expressive, asynchronous C++26 webdev library
Loading...
Searching...
No Matches
Thoth::Http::MethodConcept Concept Reference

The HTTP methods requirements following RFC9110. More...

#include <MethodConcept.hpp>

Concept definition

template<class T>
concept Thoth::Http::MethodConcept = requires(T t, string_view body, Url url, Headers headers, StatusCodeEnum statusCode) {
requires requires { { T::MethodName() } -> std::same_as<string_view>; };
{ T::IsSafe() } -> std::same_as<bool>;
{ T::IsIdempotent() } -> std::same_as<bool>;
{ T::ValidateRequest(body, url, headers) } -> std::same_as<WebResultOper>;
{ T::ValidateResponse(statusCode, body, url, headers) } -> std::same_as<WebResultOper>;
}
The HTTP methods requirements following RFC9110.
Definition MethodConcept.hpp:19
StatusCodeEnum
Definition StatusCodeEnum.hpp:7
std::string_view string_view
Definition Url.hpp:7

Detailed Description

The HTTP methods requirements following RFC9110.

Canonical methods of HTTP just compare if a request is well-formed with body, but some methods (like "Lock-Token" for LOCK / UNLOCK in WebDAV or RPC's "Content-Type: application/rpc") also needs to validate the headers, so I decided to leave it more generic so a class that satisfies MethodConcept have all the info available to do it validation.