Skip to content

Commit 2f75bab

Browse files
committedMay 16, 2017
[server] Add url and post data getters to request handler
This completes the API to eventually get rid of all getEnv usage from python server plugins. The request handler has now access to the request URL and POST data without the need to query the env.
1 parent e3d79a1 commit 2f75bab

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed
 

‎src/server/qgsrequesthandler.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,16 @@ QByteArray QgsRequestHandler::body() const
121121
return mResponse.data();
122122
}
123123

124+
QByteArray QgsRequestHandler::data() const
125+
{
126+
return mRequest.data( );
127+
}
128+
129+
QString QgsRequestHandler::url() const
130+
{
131+
return mRequest.url( ).toString( );
132+
}
133+
124134
void QgsRequestHandler::setStatusCode( int code )
125135
{
126136
mResponse.setStatusCode( code );

‎src/server/qgsrequesthandler.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,12 @@ class SERVER_EXPORT QgsRequestHandler
104104
//! Return response body data
105105
QByteArray body() const;
106106

107+
//! Return request POST data (can be null)
108+
QByteArray data() const;
109+
110+
//! Return request url
111+
QString url() const;
112+
107113
//! Set response http status code
108114
void setStatusCode( int code );
109115

0 commit comments

Comments
 (0)
Please sign in to comment.