Commit 3aa12a43 authored by Volker Krause's avatar Volker Krause
Browse files

Add location request type checks to the OTP backends

parent 0b0cb95f
Pipeline #45247 passed with stage
in 23 seconds
......@@ -44,6 +44,10 @@ bool OpenTripPlannerGraphQLBackend::needsLocationQuery(const Location &loc, Abst
bool OpenTripPlannerGraphQLBackend::queryLocation(const LocationRequest &req, LocationReply *reply, QNetworkAccessManager *nam) const
{
if ((req.types() & (Location::Stop | Location::RentedVehicle | Location::RentedVehicleStation)) == 0) {
return false;
}
auto gqlReq = graphQLRequest();
if (req.hasCoordinate()) {
gqlReq.setQueryFromFile(graphQLPath(QStringLiteral("stationByCoordinate.graphql")));
......
......@@ -49,6 +49,10 @@ bool OpenTripPlannerRestBackend::needsLocationQuery(const Location &loc, Abstrac
bool OpenTripPlannerRestBackend::queryLocation(const LocationRequest &req, LocationReply *reply, QNetworkAccessManager *nam) const
{
if ((req.types() & Location::Stop) == 0) {
return false;
}
if (req.hasCoordinate()) {
QUrlQuery query;
query.addQueryItem(QStringLiteral("lat"), QString::number(req.latitude()));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment