Commit 17e5919a authored by Jacek Furmankiewicz's avatar Jacek Furmankiewicz

docs

parent e1b101be
...@@ -168,6 +168,7 @@ the body will be automatically parsed to JSON, YAML and XML (ElementTree) and at ...@@ -168,6 +168,7 @@ the body will be automatically parsed to JSON, YAML and XML (ElementTree) and at
* request.yaml * request.yaml
* request.xml * request.xml
@route("/post/json",(Http.POST,Http.PUT)) @route("/post/json",(Http.POST,Http.PUT))
def test_json(self,request,**kwargs): def test_json(self,request,**kwargs):
return "%s" % json.dumps(request.json) return "%s" % json.dumps(request.json)
...@@ -183,8 +184,7 @@ the body will be automatically parsed to JSON, YAML and XML (ElementTree) and at ...@@ -183,8 +184,7 @@ the body will be automatically parsed to JSON, YAML and XML (ElementTree) and at
*Routing requests by incoming content type* *Routing requests by incoming content type*
Based on the incoming content type in POST/PUT requests, Based on the incoming content type in POST/PUT requests, the *same* URL can be hooked up to different router methods:
the *same* URL can be hooked up to different router methods:
@route("/post/by/content",(Http.POST,Http.PUT),MediaType.APPLICATION_JSON) @route("/post/by/content",(Http.POST,Http.PUT),MediaType.APPLICATION_JSON)
def test_content_app_json(self,request,**kwargs): def test_content_app_json(self,request,**kwargs):
...@@ -205,8 +205,7 @@ the *same* URL can be hooked up to different router methods: ...@@ -205,8 +205,7 @@ the *same* URL can be hooked up to different router methods:
*Converting Python objects to content type based on what caller can accept* *Converting Python objects to content type based on what caller can accept*
Instead of returning string responses, the code can just return Python objects. Instead of returning string responses, the code can just return Python objects.
Depending whether the caller can accept JSON (default) or YAML, the Python objects Depending whether the caller can accept JSON (default) or YAML, the Python objects will be automatically converted:
will be automatically converted:
@route("/return/by/accept") @route("/return/by/accept")
def test_return_content_by_accepts(self,request,**kwargs): def test_return_content_by_accepts(self,request,**kwargs):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment