Skip to content

Commit ced9849

Browse files
fix(rest): define ToString(HttpMethod) inline in header
1 parent b730178 commit ced9849

2 files changed

Lines changed: 15 additions & 17 deletions

File tree

src/iceberg/catalog/rest/endpoint.cc

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,6 @@
2424

2525
namespace iceberg::rest {
2626

27-
constexpr std::string_view ToString(HttpMethod method) {
28-
switch (method) {
29-
case HttpMethod::kGet:
30-
return "GET";
31-
case HttpMethod::kPost:
32-
return "POST";
33-
case HttpMethod::kPut:
34-
return "PUT";
35-
case HttpMethod::kDelete:
36-
return "DELETE";
37-
case HttpMethod::kHead:
38-
return "HEAD";
39-
}
40-
return "UNKNOWN";
41-
}
42-
4327
Result<Endpoint> Endpoint::Make(HttpMethod method, std::string_view path) {
4428
if (path.empty()) {
4529
return InvalidArgument("Endpoint cannot have empty path");

src/iceberg/catalog/rest/http_request.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,21 @@ namespace iceberg::rest {
3535
enum class HttpMethod : uint8_t { kGet, kPost, kPut, kDelete, kHead };
3636

3737
/// \brief Convert HttpMethod to string representation.
38-
constexpr std::string_view ToString(HttpMethod method);
38+
constexpr std::string_view ToString(HttpMethod method) {
39+
switch (method) {
40+
case HttpMethod::kGet:
41+
return "GET";
42+
case HttpMethod::kPost:
43+
return "POST";
44+
case HttpMethod::kPut:
45+
return "PUT";
46+
case HttpMethod::kDelete:
47+
return "DELETE";
48+
case HttpMethod::kHead:
49+
return "HEAD";
50+
}
51+
return "UNKNOWN";
52+
}
3953

4054
/// \brief Ordered collection of HTTP headers preserving repeated values.
4155
///

0 commit comments

Comments
 (0)