[ADD] Ping homeserver to see if Parsee works

This commit is contained in:
LDA 2024-11-17 16:22:10 +01:00
commit 5d13410ac4
5 changed files with 75 additions and 4 deletions

38
src/Routes/Ping.c Normal file
View 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;
}