From dbb65f059c4adb3fee16f1e574086ba7c40f2117 Mon Sep 17 00:00:00 2001 From: Ashley Sommer Date: Tue, 25 Feb 2020 16:57:07 +1000 Subject: [PATCH] typo in last commit Update readme to reflect changes to automatic_options --- README.rst | 5 +++-- sanic_cors/extension.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index 1363380..a5be9c7 100644 --- a/README.rst +++ b/README.rst @@ -120,8 +120,9 @@ via the options method, Sanic by default only allows the ``GET`` method, in orde service your CORS requests you must specify ``OPTIONS`` in the methods argument to your routes decorator. -Alternately, you can use the ``automatic_options`` configuration parameter to -handle the ``OPTIONS`` response automatically for you. +Sanic-CORS includes an ``automatic_options`` configuration parameter to +allow the plugin handle the ``OPTIONS`` response automatically for you. This is enabled by default, but you +can turn it off if you wish to do your own ``OPTIONS`` response. .. code:: python diff --git a/sanic_cors/extension.py b/sanic_cors/extension.py index 732829f..f87f546 100644 --- a/sanic_cors/extension.py +++ b/sanic_cors/extension.py @@ -256,7 +256,7 @@ def unapplied_cors_request_middleware(req, context): "context. Has request started? Is request ended?") set_cors_headers(req, resp, request_context, res_options) if request_context is not None: - setattr(req.ctx, SANIC_CORS_EVALUATED, "1") + setattr(request_context, SANIC_CORS_EVALUATED, "1") return resp else: debug('No CORS rule matches')