diff --git a/docs/README.rst b/docs/README.rst --- a/docs/README.rst +++ b/docs/README.rst @@ -38,8 +38,7 @@ retrieve it using the :ref:`vault ` feature of the SWH Archive platform. The differences between a piece of code uploaded using the deposit rather than simply -asking SWH to archive a repository using the `save code now -`_ feature are: +asking SWH to archive a repository using the :swh_web:`save/` feature are: - a deposited artifact is provided from one of the SWH partners which is regarded as a trusted authority, diff --git a/swh/deposit/api/common.py b/swh/deposit/api/common.py --- a/swh/deposit/api/common.py +++ b/swh/deposit/api/common.py @@ -807,8 +807,17 @@ - 415 (unsupported media type) if a wrong media type is provided """ + metadata_stream = request.data + if not metadata_stream: + raise DepositError( + BAD_REQUEST, + "Empty body request is not supported", + "Atom entry deposit is supposed to send for metadata. " + "If the body is empty, there is no metadata.", + ) + try: - raw_metadata, metadata = self._read_metadata(request.data) + raw_metadata, metadata = self._read_metadata(metadata_stream) except ParserError: raise DepositError( BAD_REQUEST,