#NEWLINE# def test_cors_preflight_request( self ) : #NEWLINE# #INDENT# '\n        Check that preflight request contains right headers\n        ' #NEWLINE# self . _app . mod_opts [ 'cors_origin' ] = '*' #NEWLINE# request_headers = 'X-Auth-Token, accept, content-type' #NEWLINE# preflight_headers = { #NEWLINE# #INDENT# 'Access-Control-Request-Headers' : request_headers , #NEWLINE# 'Access-Control-Request-Method' : 'GET' , #NEWLINE# #UNINDENT# } #NEWLINE# response = self . fetch ( '/' , method = 'OPTIONS' , headers = preflight_headers ) #NEWLINE# headers = response . headers #NEWLINE# self . assertEqual ( response . code , 204 ) #NEWLINE# self . assertEqual ( headers [ 'Access-Control-Allow-Headers' ] , request_headers ) #NEWLINE# self . assertEqual ( headers [ 'Access-Control-Expose-Headers' ] , 'X-Auth-Token' ) #NEWLINE# self . assertEqual ( preflight_headers [ 'Access-Control-Allow-Methods' ] , 'OPTIONS, GET, POST' ) #NEWLINE# self . assertEqual ( response . code , 204 )