#NEWLINE# def test_ie_fixes( self ) : #NEWLINE# #INDENT# @ fixers . InternetExplorerFix #NEWLINE# @ Request . application #NEWLINE# def application( request ) : #NEWLINE# #INDENT# response = Response ( 'binary data here' , mimetype = 'application/vnd.ms-excel' ) #NEWLINE# response . headers [ 'Vary' ] = 'Cookie' #NEWLINE# response . headers [ 'Content-Disposition' ] = 'attachment; filename=foo.xls' #NEWLINE# return response #NEWLINE# #UNINDENT# c = Client ( application , Response ) #NEWLINE# response = c . get ( '/' , headers = [ ( 'User-Agent' , 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)' ) ] ) #NEWLINE# self . assert_equal ( response . get_data ( ) , b'binary data here' ) #NEWLINE# assert ( 'vary' not in response . headers ) #NEWLINE# assert ( response . headers [ 'content-disposition' ] == 'attachment; filename=foo.xls' ) #NEWLINE# assert ( response . headers [ 'content-type' ] == 'application/vnd.ms-excel' ) #NEWLINE# c = Client ( application , Response ) #NEWLINE# response = c . get ( '/' ) #NEWLINE# self . assert_equal ( response . get_data ( ) , b'binary data here' ) #NEWLINE# assert ( 'vary' in response . headers ) #NEWLINE# cc = ResponseCacheControl ( ) #NEWLINE# cc . no_cache = True #NEWLINE# @ fixers . InternetExplorerFix #NEWLINE# @ Request . application #NEWLINE# def application( request ) : #NEWLINE# #INDENT# response = Response ( 'binary data here' , mimetype = 'application/vnd.ms-excel' ) #NEWLINE# response . headers [ 'Pragma' ] = ', ' . join ( pragma ) #NEWLINE# response . headers [ 'Cache-Control' ] = cc . to_header ( ) #NEWLINE# response . headers [ 'Content-Disposition' ] = 'attachment; filename=foo.xls' #NEWLINE# return response #NEWLINE# #UNINDENT# pragma = ( 'no-cache' , ) #NEWLINE# c = Client ( application , Response ) #NEWLINE# response = c . get ( '/' , headers = [ ( 'User-Agent' , 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)' ) ] ) #NEWLINE# self . assert_equal ( response . get_data ( ) , b'binary data here' ) #NEWLINE# assert ( 'pragma' not in response . headers ) #NEWLINE# assert ( 'cache-control' not in response . headers ) #NEWLINE# assert ( response . headers [ 'content-disposition' ] == 'attachment; filename=foo.xls' ) #NEWLINE# pragma = ( 'no-cache' , 'x-foo' ) #NEWLINE# cc . proxy_revalidate = True #NEWLINE# response = c . get ( '/' , headers = [ ( 'User-Agent' , 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)' ) ] ) #NEWLINE# self . assert_equal ( response . get_data ( ) , b'binary data here' ) #NEWLINE# assert ( response . headers [ 'pragma' ] == 'x-foo' ) #NEWLINE# assert ( response . headers [ 'cache-control' ] == 'proxy-revalidate' ) #NEWLINE# assert ( response . headers [ 'content-disposition' ] == 'attachment; filename=foo.xls' ) #NEWLINE# response = c . get ( '/' ) #NEWLINE# self . assert_equal ( response . get_data ( ) , b'binary data here' ) #NEWLINE# assert ( response . headers [ 'pragma' ] == 'no-cache, x-foo' ) #NEWLINE# cc = parse_cache_control_header ( response . headers [ 'cache-control' ] , cls = ResponseCacheControl ) #NEWLINE# assert cc . no_cache #NEWLINE# assert response . proxy_revalidate #NEWLINE# assert ( response . headers [ 'content-disposition' ] == 'attachment; filename=foo.xls' )