Middleware for camelizing request and response bodies for Sanic
Project description
Sanic Camelcase Middleware
Middleware for camelizing request and response bodies for sanic
Full documentation can be found here
How to install
pip install sanic-camelcase-middlware
Example
from sanic import Sanic from sanic_camelcase_middleware import Camelize app = Sanic(__name__) Camelize(app)
Full example
from sanic import Sanic from sanic.response import json from sanic_camelcase_middleware import Camelize app = Sanic(__name__) Camelize(app) @app.route("/post", methods=["POST"]) async def test(request): return json("is_camelcase": True, "message": request.json}) if __name__ == "__main__": app.run(host="0.0.0.0", port=8000)
To disable the middleware for request payload
from sanic import Sanic from sanic_camelcase_middleware import Camelize app = Sanic(__name__) # default `decamelize_request=True` Camelize(app, decamelize_request=False)
To disable the middleware for response body
from sanic import Sanic from sanic_camelcase_middleware import Camelize app = Sanic(__name__) # default `camelize_response=True` Camelize(app, camelize_response=False)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for sanic_camelcase_middleware-1.3.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55346b972f632d3ebdac650c86a9b15cc9e5dff01bb26864d0174a0488632b6c |
|
MD5 | b608158cf163b7237480b3f4a6c6f2a4 |
|
BLAKE2-256 | a01ac34b98c9883832fadf51313cbaa8ad0fc91747401ef9652c17990e29222c |