LibHTTP: Implement getting the correct reason phrase from HttpResponse

This adds a reason_phrase() getter and a static reason_phrase_for_code()
to the HttpResponse class.

It also changes the class to use east const style.
This commit is contained in:
Max Wipfli 2021-06-05 14:28:11 +02:00 committed by Andreas Kling
commit 631faec32f
Notes: sideshowbarker 2024-07-18 12:26:35 +09:00
2 changed files with 63 additions and 1 deletions

View file

@ -21,7 +21,10 @@ public:
}
int code() const { return m_code; }
const HashMap<String, String, CaseInsensitiveStringTraits>& headers() const { return m_headers; }
StringView reason_phrase() const { return reason_phrase_for_code(m_code); }
HashMap<String, String, CaseInsensitiveStringTraits> const& headers() const { return m_headers; }
static StringView reason_phrase_for_code(int code);
private:
HttpResponse(int code, HashMap<String, String, CaseInsensitiveStringTraits>&&);