2019-04-07 14:36:10 +02:00
|
|
|
#pragma once
|
|
|
|
|
2019-09-06 15:34:26 +02:00
|
|
|
#include <AK/String.h>
|
2019-04-07 14:36:10 +02:00
|
|
|
#include <AK/HashMap.h>
|
2019-05-28 11:53:16 +02:00
|
|
|
#include <LibCore/CNetworkResponse.h>
|
2019-04-07 14:36:10 +02:00
|
|
|
|
2019-04-10 22:28:10 +02:00
|
|
|
class CHttpResponse : public CNetworkResponse {
|
2019-04-07 14:36:10 +02:00
|
|
|
public:
|
2019-04-10 22:28:10 +02:00
|
|
|
virtual ~CHttpResponse() override;
|
2019-06-21 18:37:47 +02:00
|
|
|
static NonnullRefPtr<CHttpResponse> create(int code, HashMap<String, String>&& headers, ByteBuffer&& payload)
|
2019-04-07 14:36:10 +02:00
|
|
|
{
|
2019-04-10 22:28:10 +02:00
|
|
|
return adopt(*new CHttpResponse(code, move(headers), move(payload)));
|
2019-04-07 14:36:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int code() const { return m_code; }
|
|
|
|
const HashMap<String, String>& headers() const { return m_headers; }
|
|
|
|
|
|
|
|
private:
|
2019-04-10 22:28:10 +02:00
|
|
|
CHttpResponse(int code, HashMap<String, String>&&, ByteBuffer&&);
|
2019-04-07 14:36:10 +02:00
|
|
|
|
|
|
|
int m_code { 0 };
|
|
|
|
HashMap<String, String> m_headers;
|
|
|
|
};
|