1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 20:27:34 +00:00

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
parent 977b3509f2
commit 631faec32f
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>&&);