Mapping of HTTP status codes to short string explanation. Copied from libevent http.c success_phrases[] and client_error_phrases[]
| 24 | //! Mapping of HTTP status codes to short string explanation. |
| 25 | //! Copied from libevent http.c success_phrases[] and client_error_phrases[] |
| 26 | inline std::string_view HTTPStatusReasonString(HTTPStatusCode code) |
| 27 | { |
| 28 | switch (code) { |
| 29 | case HTTP_OK: return "OK"; |
| 30 | case HTTP_NO_CONTENT: return "No Content"; |
| 31 | case HTTP_BAD_REQUEST: return "Bad Request"; |
| 32 | case HTTP_UNAUTHORIZED: return "Unauthorized"; |
| 33 | case HTTP_FORBIDDEN: return "Forbidden"; |
| 34 | case HTTP_NOT_FOUND: return "Not Found"; |
| 35 | case HTTP_BAD_METHOD: return "Method Not Allowed"; |
| 36 | case HTTP_CONTENT_TOO_LARGE: return "Content too large"; |
| 37 | case HTTP_INTERNAL_SERVER_ERROR: return "Internal Server Error"; |
| 38 | case HTTP_SERVICE_UNAVAILABLE: return "Service Unavailable"; |
| 39 | } |
| 40 | |
| 41 | // Reason phrases are optional and may be replaced by local variants. |
| 42 | // https://httpwg.org/specs/rfc9110.html#rfc.section.15.1 |
| 43 | return ""; |
| 44 | } |
| 45 | |
| 46 | //! Bitcoin RPC error codes |
| 47 | enum RPCErrorCode |