2019-04-07 14:36:10 +02:00
|
|
|
#pragma once
|
|
|
|
|
2019-09-06 15:34:26 +02:00
|
|
|
#include <AK/String.h>
|
2019-08-10 19:32:03 +02:00
|
|
|
#include <AK/URL.h>
|
2019-04-07 14:36:10 +02:00
|
|
|
|
2019-04-10 22:28:10 +02:00
|
|
|
class CNetworkJob;
|
2019-04-07 14:36:10 +02:00
|
|
|
|
2019-04-10 22:28:10 +02:00
|
|
|
class CHttpRequest {
|
2019-04-07 14:36:10 +02:00
|
|
|
public:
|
2019-06-07 17:13:23 +02:00
|
|
|
enum Method {
|
2019-05-28 11:53:16 +02:00
|
|
|
Invalid,
|
|
|
|
HEAD,
|
|
|
|
GET,
|
|
|
|
POST
|
|
|
|
};
|
2019-04-07 14:36:10 +02:00
|
|
|
|
2019-04-10 22:28:10 +02:00
|
|
|
CHttpRequest();
|
|
|
|
~CHttpRequest();
|
2019-04-07 14:36:10 +02:00
|
|
|
|
2019-08-10 19:32:03 +02:00
|
|
|
const URL& url() const { return m_url; }
|
|
|
|
void set_url(const URL& url) { m_url = url; }
|
2019-04-07 14:36:10 +02:00
|
|
|
|
2019-08-10 19:32:03 +02:00
|
|
|
Method method() const { return m_method; }
|
2019-04-07 14:36:10 +02:00
|
|
|
void set_method(Method method) { m_method = method; }
|
|
|
|
|
|
|
|
String method_name() const;
|
|
|
|
ByteBuffer to_raw_request() const;
|
|
|
|
|
2019-09-22 00:31:54 +02:00
|
|
|
RefPtr<CNetworkJob> schedule();
|
2019-04-07 14:36:10 +02:00
|
|
|
|
|
|
|
private:
|
2019-08-10 19:32:03 +02:00
|
|
|
URL m_url;
|
2019-04-07 14:36:10 +02:00
|
|
|
Method m_method { GET };
|
|
|
|
};
|