From 7971eb28f8b04af0dcf697731c82baf158d614c7 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Sun, 30 Nov 2025 13:11:05 -0800 Subject: [PATCH] chore: to_string(status) --- include/boost/http_proto/request.hpp | 2 +- include/boost/http_proto/response.hpp | 4 ++-- include/boost/http_proto/response_base.hpp | 4 ++-- include/boost/http_proto/status.hpp | 2 +- src/status.cpp | 4 ++-- test/unit/status.cpp | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/boost/http_proto/request.hpp b/include/boost/http_proto/request.hpp index e9741b0f..075d9bcb 100644 --- a/include/boost/http_proto/request.hpp +++ b/include/boost/http_proto/request.hpp @@ -161,7 +161,7 @@ class request @endcode @par Complexity - Linear in `obsolete_reason(s).size()`. + Linear in `to_string(s).size()`. @par Exception Safety Calls to allocate may throw. diff --git a/include/boost/http_proto/response.hpp b/include/boost/http_proto/response.hpp index 0650abb7..e4086ec2 100644 --- a/include/boost/http_proto/response.hpp +++ b/include/boost/http_proto/response.hpp @@ -165,7 +165,7 @@ class response @endcode @par Complexity - Linear in `obsolete_reason(s).size()`. + Linear in `to_string(s).size()`. @par Exception Safety Calls to allocate may throw. @@ -195,7 +195,7 @@ class response @endcode @par Complexity - Linear in `obsolete_reason(s).size()`. + Linear in `to_string(s).size()`. @par Exception Safety Calls to allocate may throw. diff --git a/include/boost/http_proto/response_base.hpp b/include/boost/http_proto/response_base.hpp index 9eb75280..aea2ddb9 100644 --- a/include/boost/http_proto/response_base.hpp +++ b/include/boost/http_proto/response_base.hpp @@ -126,7 +126,7 @@ class response_base { set_start_line_impl(sc, static_cast(sc), - obsolete_reason(sc), v); + to_string(sc), v); } /** Set the HTTP version of the response @@ -173,7 +173,7 @@ class response_base detail::throw_invalid_argument(); set_start_line_impl(sc, static_cast(sc), - obsolete_reason(sc), + to_string(sc), version()); } diff --git a/include/boost/http_proto/status.hpp b/include/boost/http_proto/status.hpp index bff36fa1..e477bf86 100644 --- a/include/boost/http_proto/status.hpp +++ b/include/boost/http_proto/status.hpp @@ -176,7 +176,7 @@ to_status_class(status v); */ BOOST_HTTP_PROTO_DECL core::string_view -obsolete_reason(status v); +to_string(status v); /** Outputs the reason-phrase of a status code to a stream. diff --git a/src/status.cpp b/src/status.cpp index 2ad4fb5c..063367dd 100644 --- a/src/status.cpp +++ b/src/status.cpp @@ -125,7 +125,7 @@ to_status_class(status v) } core::string_view -obsolete_reason( +to_string( status v) { switch(static_cast(v)) @@ -210,7 +210,7 @@ obsolete_reason( std::ostream& operator<<(std::ostream& os, status v) { - return os << obsolete_reason(v); + return os << to_string(v); } } // http_proto diff --git a/test/unit/status.cpp b/test/unit/status.cpp index a0f9e7d1..a8eb412a 100644 --- a/test/unit/status.cpp +++ b/test/unit/status.cpp @@ -99,7 +99,7 @@ class status_test auto const good = [&](status v) { - BOOST_TEST(obsolete_reason(v) != "Unknown Status"); + BOOST_TEST(to_string(v) != "Unknown Status"); }; good(status::continue_); good(status::switching_protocols);