diff options
author | ianb <devnull@localhost> | 2005-12-13 07:00:20 +0000 |
---|---|---|
committer | ianb <devnull@localhost> | 2005-12-13 07:00:20 +0000 |
commit | 4e73bff9da87e35c7154ab1cc923bb4f9d40711d (patch) | |
tree | d2e4c92965398700457280d5829dfaa5cdf5b4fb /paste/lint.py | |
parent | 55b404e53bc834daf3852069af6de9b1fca4c742 (diff) | |
download | paste-4e73bff9da87e35c7154ab1cc923bb4f9d40711d.tar.gz |
Merged changes from cce branch (r3727:HEAD/4008); the branch is now in sync with trunk
Diffstat (limited to 'paste/lint.py')
-rw-r--r-- | paste/lint.py | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/paste/lint.py b/paste/lint.py index b3bee02..916f1af 100644 --- a/paste/lint.py +++ b/paste/lint.py @@ -192,7 +192,8 @@ def check_environ(environ): check_errors(environ['wsgi.errors']) # @@: these need filling out: - assert environ['REQUEST_METHOD'] in ('GET', 'HEAD', 'POST'), ( + assert environ['REQUEST_METHOD'] in ('GET', 'HEAD', 'POST', + 'OPTIONS','PUT','DELETE','TRACE'), ( "Unknown REQUEST_METHOD: %r" % environ['REQUEST_METHOD']) assert (not environ.get('SCRIPT_NAME') @@ -262,16 +263,17 @@ def check_headers(headers): def check_content_type(status, headers): code = int(status.split(None, 1)[0]) - if code == 204: - # 204 No Content is the only code where there's no body, - # and so it doesn't need a content-type header. - # @@: Not 100% sure this is the only case where a content-type - # header can be left out - return + # @@: need one more person to verify this interpretation of RFC 2616 + # http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html + NO_MESSAGE_BODY = (204,304) for name, value in headers: if name.lower() == 'content-type': - return - assert 0, "No Content-Type header found in headers (%s)" % headers + if code not in NO_MESSAGE_BODY: + return + assert 0, (("Content-Type header found in a %s response, " + "which must not return content.") % code) + if code not in NO_MESSAGE_BODY: + assert 0, "No Content-Type header found in headers (%s)" % headers def check_exc_info(exc_info): assert not exc_info or type(exc_info) is type(()), ( |