From b8b172b3b310dc988fa08f7b3f51b266b39afa8f Mon Sep 17 00:00:00 2001 From: tqcq <99722391+tqcq@users.noreply.github.com> Date: Fri, 14 Jun 2024 12:43:42 +0800 Subject: [PATCH] feat support http_types ToString() --- tile/net/http/types.cc | 10 ++++++++++ tile/net/http/types.h | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/tile/net/http/types.cc b/tile/net/http/types.cc index cbce7b5..d99ca67 100644 --- a/tile/net/http/types.cc +++ b/tile/net/http/types.cc @@ -165,4 +165,14 @@ TryParseTraits::TryParse(Slice version) { return iter->second; } +std::ostream &operator<<(std::ostream &os, HttpMethod method) { + return os << ToSlice(method); +} +std::ostream &operator<<(std::ostream &os, HttpStatus status) { + return os << ToSlice(status); +} +std::ostream &operator<<(std::ostream &os, HttpVersion version) { + return os << ToSlice(version); +} + } // namespace tile diff --git a/tile/net/http/types.h b/tile/net/http/types.h index 30ac0c0..7a9aa91 100644 --- a/tile/net/http/types.h +++ b/tile/net/http/types.h @@ -91,6 +91,10 @@ template <> struct TryParseTraits { static std::optional TryParse(Slice s); }; +std::ostream &operator<<(std::ostream &os, HttpMethod method); +std::ostream &operator<<(std::ostream &os, HttpStatus status); +std::ostream &operator<<(std::ostream &os, HttpVersion version); + } // namespace tile #endif // _TILE_NET_HTTP_TYPES_H