-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrequests.h
More file actions
36 lines (26 loc) · 897 Bytes
/
requests.h
File metadata and controls
36 lines (26 loc) · 897 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
#ifndef REQUESTS_H
#define REQUESTS_H
#include <functional>
#include <iostream>
#include <string>
#include <unordered_map>
using namespace std;
struct Requestobj {
string method;
string url;
string body;
};
extern Requestobj req;
using functionType = function<void(Requestobj&)>;
extern unordered_map<string, functionType> setget;
extern unordered_map<string , functionType> setpost;
extern unordered_map<string, functionType> setput;
extern unordered_map<string, functionType> setpatch;
extern unordered_map<string, functionType> setdel;
void setRequest(const string &buffer);
void GET(const string &url, void (*func)(Requestobj&));
void POST(const string &url, void (*func)(Requestobj&));
void PUT(const string &url, void (*func)(Requestobj&));
void PATCH(const string &url, void (*func)(Requestobj&));
void DELETE(const string &url, void (*func)(Requestobj&));
#endif