Header enforcement on Content-Length 0

Updates the middleware enforement of content-type to exclude
cases where Content-Length is zero - for example an empty
POST to tag a revision.

Change-Id: Ib12f385c40803d8ed76d1fd3cea990d015992739
This commit is contained in:
Bryan Strassner 2017-11-29 12:38:27 -06:00
parent 639ac18dac
commit 467910343d

View File

@ -137,7 +137,8 @@ class YAMLTranslator(HookableMiddlewareMixin, object):
# is required.
requires_content_type = (
req.method not in ['GET', 'DELETE'] and (
req.content_length is not None or
(req.content_length is not None and
req.content_length > 0) or
req.get_header('transfer-encoding') is not None
)
)