def setUp(self):
self.app = Sanic(__name__)
@self.app.route('/', methods=['GET', 'HEAD', 'OPTIONS'])
@cross_origin(self.app)
def wildcard(request):
return text('Welcome!')
@self.app.route('/test_consistent_origin', methods=['GET', 'HEAD', 'OPTIONS'])
@cross_origin(self.app, origins='http://foo.com')
def test_consistent(request):
return text('Welcome!')
@self.app.route('/test_vary', methods=['GET', 'HEAD', 'OPTIONS'])
@cross_origin(self.app, origins=["http://foo.com", "http://bar.com"])
def test_vary(request):
return text('Welcome!')
@self.app.route('/test_existing_vary_headers')
@cross_origin(self.app, origins=["http://foo.com", "http://bar.com"])
def test_existing_vary_headers(request):
return HTTPResponse('', status=200, headers=CIDict({'Vary': 'Accept-Encoding'}))
评论列表
文章目录