Line data Source code
1 : /* Copyright (c) 2017, EPFL/Blue Brain Project
2 : * Stefan.Eilemann@epfl.ch
3 : * Raphael.Dumusc@epfl.ch
4 : */
5 :
6 : #pragma once
7 :
8 : #include <zeroeq/types.h>
9 :
10 : #include <string> // member
11 :
12 : namespace zeroeq
13 : {
14 : namespace http
15 : {
16 : /** HTTP method used in a Request. */
17 : enum class Method
18 : {
19 : GET,
20 : POST,
21 : PUT,
22 : PATCH,
23 : DELETE,
24 : OPTIONS,
25 : ALL //!< @internal, must be last
26 : };
27 :
28 : /**
29 : * HTTP Request with method, path and body.
30 : *
31 : * The path provides the url part after the registered endpoint if it is
32 : * terminated with a slash.
33 : * Registered endpoint || HTTP request || path
34 : * "api/windows/" || "api/windows/jf321f" || "jf321f".
35 : * "api/windows/" || "api/windows/" || ""
36 : *
37 : * If an endpoint is not terminated with a slash, then only exactly matching
38 : * HTTP request will be processed.
39 : * Registered endpoint || HTTP request || path
40 : * "api/objects" || "api/objects" || ""
41 : * "api/objects" || "api/objects/abc" || ** ENDPOINT NOT FOUND: 404 **
42 : *
43 : * The query is the url part after "?".
44 : * Registered endpoint || HTTP request || query || path
45 : * "api/objects" || "api/objects?size=4" || "size=4" || ""
46 : * "api/windows/" || "api/windows/jf321f?size=4" || "size=4" || "jf321"
47 : *
48 : * The body is the HTTP request payload.
49 : */
50 416 : struct Request
51 : {
52 : Method method;
53 : std::string path;
54 : std::string source;
55 : std::string query;
56 : std::string body;
57 : };
58 : }
59 : }
|