Implementing a redirect for a GET on / to list of dagruns
This commit is contained in:
@@ -40,6 +40,7 @@ namespace daggy::daggyd {
|
||||
void queueDAG_(DAGRunID runID, const TaskDAG &dag,
|
||||
const TaskParameters &taskParameters);
|
||||
|
||||
DAGGY_REST_HANDLER(handleRoot); // X
|
||||
DAGGY_REST_HANDLER(handleReady); // X
|
||||
DAGGY_REST_HANDLER(handleQueryDAGs); // X
|
||||
DAGGY_REST_HANDLER(handleRunDAG); // X
|
||||
|
||||
@@ -101,6 +101,11 @@ namespace daggy::daggyd {
|
||||
.response(Http::Code::Ok, "Response to the /ready call")
|
||||
.hide();
|
||||
|
||||
desc_.route(desc_.get("/"))
|
||||
.bind(&Server::handleRoot, this)
|
||||
.response(Http::Code::Ok, "Response to the /ready call")
|
||||
.hide();
|
||||
|
||||
auto versionPath = desc_.path("/v1");
|
||||
|
||||
/*
|
||||
@@ -646,6 +651,15 @@ namespace daggy::daggyd {
|
||||
response.send(Pistache::Http::Code::Ok, R"({ "msg": "Ya like DAGs?"}\n)");
|
||||
}
|
||||
|
||||
void Server::handleRoot(const Pistache::Rest::Request &request,
|
||||
Pistache::Http::ResponseWriter response)
|
||||
{
|
||||
response.headers().add(
|
||||
std::make_shared<Pistache::Http::Header::Location>("/v1/dagruns"));
|
||||
response.send(Pistache::Http::Code::Moved_Permanently,
|
||||
R"({ "msg": "These are the dags you are looking for"}\n)");
|
||||
}
|
||||
|
||||
/*
|
||||
* handleAuth will check any auth methods and handle any responses in the
|
||||
* case of failed auth. If it returns false, callers should cease handling
|
||||
|
||||
Reference in New Issue
Block a user