diff --git a/webservice/README.rst b/webservice/README.rst index 047ae360..05a2e16f 100644 --- a/webservice/README.rst +++ b/webservice/README.rst @@ -28,7 +28,9 @@ WebService |badge1| |badge2| |badge3| |badge4| |badge5| -This module creates WebService frameworks to be used globally +This module creates WebService frameworks to be used globally. + +The module introduces support for HTTP Request protocol. The webservice HTTP call returns by default the content of the response. A context 'content_only' can be passed to get the full response object. **Table of contents** diff --git a/webservice/components/request_adapter.py b/webservice/components/request_adapter.py index 2a2ca946..72b5a07f 100644 --- a/webservice/components/request_adapter.py +++ b/webservice/components/request_adapter.py @@ -24,6 +24,7 @@ class BaseRestRequestsAdapter(Component): # TODO: url and url_params could come from work_ctx def _request(self, method, url=None, url_params=None, **kwargs): url = self._get_url(url=url, url_params=url_params) + content_only = kwargs.pop("content_only", True) new_kwargs = kwargs.copy() new_kwargs.update( { @@ -35,7 +36,9 @@ def _request(self, method, url=None, url_params=None, **kwargs): # pylint: disable=E8106 request = requests.request(method, url, **new_kwargs) request.raise_for_status() - return request.content + if content_only: + return request.content + return request def get(self, **kwargs): return self._request("get", **kwargs) diff --git a/webservice/readme/DESCRIPTION.rst b/webservice/readme/DESCRIPTION.rst index db2c75a7..cdd44bd7 100644 --- a/webservice/readme/DESCRIPTION.rst +++ b/webservice/readme/DESCRIPTION.rst @@ -1 +1,3 @@ -This module creates WebService frameworks to be used globally +This module creates WebService frameworks to be used globally. + +The module introduces support for HTTP Request protocol. The webservice HTTP call returns by default the content of the response. A context 'content_only' can be passed to get the full response object. diff --git a/webservice/static/description/index.html b/webservice/static/description/index.html index ed3e8ad8..300f07ae 100644 --- a/webservice/static/description/index.html +++ b/webservice/static/description/index.html @@ -369,7 +369,8 @@
This module creates WebService frameworks to be used globally
+This module creates WebService frameworks to be used globally.
+The module introduces support for HTTP Request protocol. The webservice HTTP call returns by default the content of the response. A context ‘content_only’ can be passed to get the full response object.
Table of contents