Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Libraries
KPublicTransport
Commits
b30533b3
Commit
b30533b3
authored
Sep 10, 2021
by
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
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/lib/backends/openjourneyplannerbackend.cpp
View file @
b30533b3
...
...
@@ -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
());
}
...
...
src/lib/backends/openjourneyplannerbackend.h
View file @
b30533b3
...
...
@@ -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"
;
};
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment