mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 15:05:11 +00:00
[ADD] Ping homeserver to see if Parsee works
This commit is contained in:
parent
7f41a85a8a
commit
5d13410ac4
5 changed files with 75 additions and 4 deletions
38
src/Routes/Ping.c
Normal file
38
src/Routes/Ping.c
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#include <Routes.h>
|
||||
|
||||
#include <Cytoplasm/Log.h>
|
||||
|
||||
#include <Matrix.h>
|
||||
#include <AS.h>
|
||||
|
||||
RouteHead(RoutePing, arr, argp)
|
||||
{
|
||||
ParseeHttpArg *args = argp;
|
||||
HashMap *request = NULL;
|
||||
HashMap *response = NULL;
|
||||
Array *events;
|
||||
size_t i;
|
||||
|
||||
response = ASVerifyRequest(args);
|
||||
if (response)
|
||||
{
|
||||
goto end;
|
||||
}
|
||||
if (HttpRequestMethodGet(args->ctx) != HTTP_POST)
|
||||
{
|
||||
HttpResponseStatus(args->ctx, HTTP_METHOD_NOT_ALLOWED);
|
||||
response = MatrixCreateError(
|
||||
"M_UNRECOGNIZED",
|
||||
"Path /ping only accepts POST as a valid method."
|
||||
);
|
||||
goto end;
|
||||
}
|
||||
|
||||
RequestJSON();
|
||||
|
||||
response = HashMapCreate();
|
||||
end:
|
||||
(void) arr;
|
||||
JsonFree(request);
|
||||
return response;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue