forked from awwit/httpserverapp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResponse.h
More file actions
35 lines (29 loc) · 787 Bytes
/
Response.h
File metadata and controls
35 lines (29 loc) · 787 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#pragma once
#include "protocol/ServerProtocol.h"
#include "../transfer/ProtocolVariant.h"
#include "../transfer/HttpStatusCode.h"
#include <unordered_map>
#include <string>
namespace HttpServer
{
struct Response
{
ServerProtocol *prot;
Transfer::ProtocolVariant protocol_variant;
std::unordered_map<std::string, std::string> headers;
Http::StatusCode status;
public:
void setStatusCode(const Http::StatusCode status) noexcept;
bool sendHeaders(
const std::vector<std::pair<std::string, std::string> > &additional,
const std::chrono::milliseconds &timeout,
const bool endStream = true
) const;
long sendData(
const void *src,
const size_t size,
const std::chrono::milliseconds &timeout,
const bool endStream = true
) const noexcept;
};
}