43 lines
664 B
C++
43 lines
664 B
C++
#pragma once
|
|
|
|
#include "HttpHeader.h"
|
|
#include "HttpPreamble.h"
|
|
|
|
#include <string>
|
|
|
|
class HttpRequest
|
|
{
|
|
public:
|
|
|
|
enum class Verb
|
|
{
|
|
GET,
|
|
PUT,
|
|
POST,
|
|
PATCH,
|
|
_DELETE,
|
|
UNKNOWN
|
|
};
|
|
|
|
HttpRequest() = default;
|
|
|
|
HttpRequest(Verb verb, const std::string& path = {});
|
|
|
|
Verb getVerb() const;
|
|
|
|
std::string getPath() const;
|
|
|
|
void fromString(const std::string& string);
|
|
|
|
std::string toString(const std::string& host) const;
|
|
|
|
std::size_t requiredBytes() const;
|
|
|
|
private:
|
|
Verb mVerb = Verb::UNKNOWN;
|
|
|
|
HttpHeader mHeader;
|
|
HttpPreamble mPreamble;
|
|
|
|
unsigned mRequiredBytes{ 0 };
|
|
};
|