diff --git a/lib/galaxy/app_unittest_utils/galaxy_mock.py b/lib/galaxy/app_unittest_utils/galaxy_mock.py index 6351b73fb9f..d738864a93a 100644 --- a/lib/galaxy/app_unittest_utils/galaxy_mock.py +++ b/lib/galaxy/app_unittest_utils/galaxy_mock.py @@ -282,7 +282,7 @@ class MockTrans: self.security = self.app.security self.history = history - self.request: Any = Bunch(headers={}, body=None) + self.request: Any = Bunch(headers={}, is_body_readable=False) self.response: Any = Bunch(headers={}, set_content_type=lambda i: None) def check_csrf_token(self, payload): diff --git a/lib/galaxy/web/framework/decorators.py b/lib/galaxy/web/framework/decorators.py index 0792d2e3f91..b93f55c5af5 100644 --- a/lib/galaxy/web/framework/decorators.py +++ b/lib/galaxy/web/framework/decorators.py @@ -158,7 +158,7 @@ def legacy_expose_api(func, to_json=True, user_required=True): if user_required and trans.anonymous: error_message = "API Authentication Required for this request" return error - if trans.request.body: + if trans.request.is_body_readable: try: kwargs["payload"] = __extract_payload_from_request(trans, func, kwargs) except ValueError: @@ -296,7 +296,7 @@ def expose_api(func, to_json=True, user_required=True, user_or_session_required= err_msg="API authentication or Galaxy session required for this request", ) - if trans.request.body: + if trans.request.is_body_readable: try: kwargs["payload"] = __extract_payload_from_request(trans, func, kwargs) except ValueError: