From c9a233f5e5142dc5fa8527c8fd526a96de55bc20 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Fri, 26 Oct 2018 10:50:58 -0400 Subject: [PATCH] api cleanup --- docs/source/tour.rst | 2 +- responder/api.py | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/docs/source/tour.rst b/docs/source/tour.rst index 74f78f4..8d82526 100644 --- a/docs/source/tour.rst +++ b/docs/source/tour.rst @@ -220,7 +220,7 @@ Want `CORS `_ ? The default parameters used by **Responder** are restrictive by default, so you'll need to explicitly enable particular origins, methods, or headers, in order for browsers to be permitted to use them in a Cross-Domain context. -In order to set custom parameters, you need to pass the ``cors_params`` argument, a dictionnary containing the following entries : +In order to set custom parameters, you need to set the ``cors_params`` argument of ``api``, a dictionnary containing the following entries: * ``allow_origins`` - A list of origins that should be permitted to make cross-origin requests. eg. ``['https://example.org', 'https://www.example.org']``. You can use ``['*']`` to allow any origin. * ``allow_origin_regex`` - A regex string to match against origins that should be permitted to make cross-origin requests. eg. ``'https://.*\.example\.org'``. diff --git a/responder/api.py b/responder/api.py index d40cfd6..00a95e9 100644 --- a/responder/api.py +++ b/responder/api.py @@ -64,10 +64,7 @@ class API: enable_hsts=False, docs_route=None, cors=False, - cors_params=None, ): - if cors_params is None: - cors_params = DEFAULT_CORS_PARAMS self.secret_key = secret_key self.title = title @@ -87,7 +84,7 @@ class API: self.hsts_enabled = enable_hsts self.cors = cors - self.cors_params = cors_params + self.cors_params = DEFAULT_CORS_PARAMS # Make the static/templates directory if they don't exist. for _dir in (self.static_dir, self.templates_dir): os.makedirs(_dir, exist_ok=True)