summaryrefslogtreecommitdiff
path: root/README.rst
diff options
context:
space:
mode:
Diffstat (limited to 'README.rst')
-rw-r--r--README.rst45
1 files changed, 43 insertions, 2 deletions
diff --git a/README.rst b/README.rst
index 64a3020..ab4b84e 100644
--- a/README.rst
+++ b/README.rst
@@ -1,3 +1,4 @@
+========================
CORS support for aiohttp
========================
@@ -126,7 +127,7 @@ from git:
$ pip install aiohttp_cors
Note that ``aiohttp_cors`` requires versions of Python >= 3.4.1 and
-``aiohttp`` >= 0.21.4.
+``aiohttp`` >= 1.1.
Usage
=====
@@ -346,6 +347,46 @@ in the router:
for route in list(app.router.routes()):
cors.add(route)
+You can also use ``CorsViewMixin`` on ``web.View``:
+
+.. code-block:: python
+
+ class CorsView(web.View, CorsViewMixin):
+
+ cors_config = {
+ "*": ResourceOption(
+ allow_credentials=True,
+ allow_headers="X-Request-ID",
+ )
+ }
+
+ @asyncio.coroutine
+ def get(self):
+ return web.Response(text="Done")
+
+ @custom_cors({
+ "*": ResourceOption(
+ allow_credentials=True,
+ allow_headers="*",
+ )
+ })
+ @asyncio.coroutine
+ def post(self):
+ return web.Response(text="Done")
+
+ cors = aiohttp_cors.setup(app, defaults={
+ "*": aiohttp_cors.ResourceOptions(
+ allow_credentials=True,
+ expose_headers="*",
+ allow_headers="*",
+ )
+ })
+
+ cors.add(
+ app.router.add_route("*", "/resource", CorsView),
+ webview=True)
+
+
Security
========
@@ -460,7 +501,7 @@ Post release steps:
Bugs
====
-Please report bugs, issues, feature requests, etc. on
+Please report bugs, issues, feature requests, etc. on
`GitHub <https://github.com/aio-libs/aiohttp_cors/issues>`__.