Commit b30533b3 authored by Volker Krause's avatar Volker Krause
Browse files

Make OJP HTTP request content type customizable

VVO's TRIAS insists on a special value there.
parent ebd379a0
Pipeline #79825 passed with stage
in 25 seconds
......@@ -132,7 +132,7 @@ bool OpenJourneyPlannerBackend::queryJourney(const JourneyRequest &request, Jour
QNetworkRequest OpenJourneyPlannerBackend::networkRequest() const
{
QNetworkRequest req(m_endpoint);
req.setHeader(QNetworkRequest::ContentTypeHeader, QByteArray("application/xml"));
req.setHeader(QNetworkRequest::ContentTypeHeader, m_contentType);
if (!m_authorization.isEmpty()) {
req.setRawHeader("Authorization", m_authorization.toUtf8());
}
......
......@@ -9,6 +9,7 @@
#include "abstractbackend.h"
#include <QByteArray>
#include <QUrl>
class QNetworkRequest;
......@@ -27,6 +28,8 @@ class OpenJourneyPlannerBackend : public AbstractBackend
Q_PROPERTY(QString authorization MEMBER m_authorization)
Q_PROPERTY(QString requestorRef MEMBER m_requestorRef)
Q_PROPERTY(bool useTrias MEMBER m_useTrias)
/** Override the default HTTP ContentType header in the request. */
Q_PROPERTY(QByteArray contentType MEMBER m_contentType)
public:
static inline constexpr const char* type() { return "openJourneyPlanner"; }
......@@ -44,6 +47,7 @@ private:
QString m_authorization;
QString m_requestorRef;
bool m_useTrias = false;
QByteArray m_contentType = "application/xml";
};
}
......
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