mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 18:25:10 +00:00
[ADD/WIP] Add some HTTP request code
We can now *register* users!
This commit is contained in:
parent
47c98cbbe3
commit
0fa95c2d14
12 changed files with 320 additions and 11 deletions
|
|
@ -9,12 +9,29 @@ typedef struct ParseeHttpArg {
|
|||
} ParseeHttpArg;
|
||||
|
||||
/* A list of all routes. */
|
||||
#define ROUTES X_ROUTE("/", RouteRoot)
|
||||
#define ROUTES X_ROUTE("/", RouteRoot) \
|
||||
X_ROUTE("/_matrix/app/v1/transactions/(.*)", RouteTxns)
|
||||
|
||||
#define X_ROUTE(path, name) extern void * name(Array *, void *);
|
||||
ROUTES
|
||||
#undef X_ROUTE
|
||||
|
||||
#define RouteHead(name, pathargs, argp) void * \
|
||||
name(Array * pathargs, void *argp)
|
||||
#define RouteHead(name, pathargs, argp) void * \
|
||||
name(Array * pathargs, void *argp)
|
||||
#define RequestJSON() do \
|
||||
{ \
|
||||
Stream *s = args->stream;\
|
||||
if (!(request = JsonDecode(s))) \
|
||||
{ \
|
||||
HttpResponseStatus( \
|
||||
args->ctx, \
|
||||
HTTP_BAD_REQUEST \
|
||||
); \
|
||||
response = MatrixCreateError(\
|
||||
"M_NO_JSON", \
|
||||
"Invalid JSON stream." \
|
||||
); \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue