Thoth
A functional, expressive, asynchronous C++26 webdev library
Loading...
Searching...
No Matches
HeadMethod.hpp
Go to the documentation of this file.
1#pragma once
3
4namespace Thoth::Http {
5 struct HeadMethod {
6 static constexpr std::string_view MethodName() { return "HEAD"; }
7 static constexpr bool IsSafe() { return true; }
8 static constexpr bool IsIdempotent() { return true; }
9
10 static WebResultOper ValidateRequest(string_view body, const Url&, const Headers&) {
11 if (!body.empty())
12 return std::unexpected{ StatusCodeEnum::BAD_REQUEST };
13 return {};
14 }
15
17 if (!body.empty())
18 return std::unexpected{ StatusCodeEnum::BAD_GATEWAY };
19 return {};
20 }
21 };
22
23 static_assert(MethodConcept<HeadMethod>);
24}
Definition Client.hpp:12
StatusCodeEnum
Definition StatusCodeEnum.hpp:7
WebResult< std::monostate > WebResultOper
Definition StatusCodeEnum.hpp:111
std::string_view string_view
Definition Url.hpp:7
Definition HeadMethod.hpp:5
static constexpr bool IsIdempotent()
Definition HeadMethod.hpp:8
static constexpr std::string_view MethodName()
Definition HeadMethod.hpp:6
static WebResultOper ValidateResponse(StatusCodeEnum, string_view body, const Url &, const Headers &)
Definition HeadMethod.hpp:16
static constexpr bool IsSafe()
Definition HeadMethod.hpp:7
static WebResultOper ValidateRequest(string_view body, const Url &, const Headers &)
Definition HeadMethod.hpp:10
This class stores the headers from HTTP.
Definition Headers.hpp:29
Definition Url.hpp:10