add doc
This commit is contained in:
parent
5d23c7644b
commit
63babae63d
|
@ -214,3 +214,28 @@ and `recv` methods to send and receive data respectively.
|
||||||
|
|
||||||
WebSocket support requires the [websockets](https://github.com/aaugustin/websockets)
|
WebSocket support requires the [websockets](https://github.com/aaugustin/websockets)
|
||||||
package by Aymeric Augustin.
|
package by Aymeric Augustin.
|
||||||
|
|
||||||
|
|
||||||
|
## About `strict_slashes`
|
||||||
|
|
||||||
|
You can make `routes` strict to trailing slash or not, it's configurable.
|
||||||
|
|
||||||
|
```python
|
||||||
|
|
||||||
|
# provide default strict_slashes value for all routes
|
||||||
|
app = Sanic('test_route_strict_slash', strict_slashes=True)
|
||||||
|
|
||||||
|
# you can also overwrite strict_slashes value for specific route
|
||||||
|
@app.get('/get', strict_slashes=False)
|
||||||
|
def handler(request):
|
||||||
|
return text('OK')
|
||||||
|
|
||||||
|
# It also works for blueprints
|
||||||
|
bp = Blueprint('test_bp_strict_slash', strict_slashes=True)
|
||||||
|
|
||||||
|
@bp.get('/bp/get', strict_slashes=False)
|
||||||
|
def handler(request):
|
||||||
|
return text('OK')
|
||||||
|
|
||||||
|
app.blueprint(bp)
|
||||||
|
```
|
||||||
|
|
|
@ -23,6 +23,7 @@ class Blueprint:
|
||||||
|
|
||||||
:param name: unique name of the blueprint
|
:param name: unique name of the blueprint
|
||||||
:param url_prefix: URL to be prefixed before all route URLs
|
:param url_prefix: URL to be prefixed before all route URLs
|
||||||
|
:param strict_slashes: strict to trailing slash
|
||||||
"""
|
"""
|
||||||
self.name = name
|
self.name = name
|
||||||
self.url_prefix = url_prefix
|
self.url_prefix = url_prefix
|
||||||
|
|
Loading…
Reference in New Issue
Block a user