Commit b24741ae by Xavier Ordoquy

Merge pull request #3114 from jpadilla/master

Fix custom parser example
parents c091addb f161241e
...@@ -144,17 +144,16 @@ By default this will include the following keys: `view`, `request`, `args`, `kwa ...@@ -144,17 +144,16 @@ By default this will include the following keys: `view`, `request`, `args`, `kwa
The following is an example plaintext parser that will populate the `request.data` property with a string representing the body of the request. The following is an example plaintext parser that will populate the `request.data` property with a string representing the body of the request.
class PlainTextParser(BaseParser): class PlainTextParser(BaseParser):
"""
Plain text parser.
"""
media_type = 'text/plain'
def parse(self, stream, media_type=None, parser_context=None):
""" """
Simply return a string representing the body of the request. Plain text parser.
""" """
return stream.read() media_type = 'text/plain'
def parse(self, stream, media_type=None, parser_context=None):
"""
Simply return a string representing the body of the request.
"""
return stream.read()
--- ---
......
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