Skip to content

Commit

Permalink
[server] Add url and post data getters to request handler
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
elpaso committed May 16, 2017
1 parent e3d79a1 commit 2f75bab
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/server/qgsrequesthandler.cpp
Expand Up @@ -121,6 +121,16 @@ QByteArray QgsRequestHandler::body() const
return mResponse.data();
}

QByteArray QgsRequestHandler::data() const
{
return mRequest.data( );
}

QString QgsRequestHandler::url() const
{
return mRequest.url( ).toString( );
}

void QgsRequestHandler::setStatusCode( int code )
{
mResponse.setStatusCode( code );
Expand Down
6 changes: 6 additions & 0 deletions src/server/qgsrequesthandler.h
Expand Up @@ -104,6 +104,12 @@ class SERVER_EXPORT QgsRequestHandler
//! Return response body data
QByteArray body() const;

//! Return request POST data (can be null)
QByteArray data() const;

//! Return request url
QString url() const;

//! Set response http status code
void setStatusCode( int code );

Expand Down

0 comments on commit 2f75bab

Please sign in to comment.