comparison tests/test_fileapp.txt @ 31:f00fcf6d9f1d

test not modified response
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 05 Mar 2012 13:49:07 -0800
parents 52103702a732
children 86b519dd8467
comparison
equal deleted inserted replaced
30:52103702a732 31:f00fcf6d9f1d
27 >>> content_length = os.path.getsize(filename) 27 >>> content_length = os.path.getsize(filename)
28 >>> content_length # don't ask me why the 'L' 28 >>> content_length # don't ask me why the 'L'
29 6L 29 6L
30 >>> req = Request.blank('/') 30 >>> req = Request.blank('/')
31 >>> res = req.get_response(app) 31 >>> res = req.get_response(app)
32 >>> print res # doctest:+ELLIPSIS 32 >>> print res
33 200 OK 33 200 OK
34 Content-Type: text/plain; charset=UTF-8 34 Content-Type: text/plain; charset=UTF-8
35 Content-Length: 6 35 Content-Length: 6
36 Last-Modified: ... GMT 36 Last-Modified: ... GMT
37 ETag: ...-... 37 ETag: ...-...
38 <BLANKLINE> 38 <BLANKLINE>
39 hello 39 hello
40 <BLANKLINE> 40 <BLANKLINE>
41 >>> req2 = Request.blank('/')
42 >>> req2.if_none_match = res.etag
43 >>> req2.get_response(app)
44 <Response ... 304 Not Modified>
45 >>> req3 = Request.blank('/')
46 >>> req3.if_modified_since = res.last_modified
47 >>> req3.get_response(app)
48 <Response ... 304 Not Modified>