Falcon Framework troubleshooting byte string request
class LoginResource(object): | |
def __init__(self, db): | |
self.db = db | |
self.logger = logging.getLogger('test.' + __name__) | |
def on_post(self, req, resp): | |
"""Handles GET requests""" | |
print(req.get_header) | |
print(req.content_type) | |
print(req.get_param('test')) | |
print(req.params) | |
print(req.stream.read().decode('utf-8')) | |
app = falcon.API() | |
app.add_route('/users/login', login) |
POST /users/login HTTP/1.1 | |
Host: localhost:5002 | |
Content-Type: application/json | |
Cache-Control: no-cache | |
Postman-Token: d5da931c-0b9e-9aaa-14ba-a9e6201f8ba7 | |
{ | |
"test": "yes" | |
} |
<bound method Request.get_header of <falcon.request.Request object at 0x7facb62a70e0>> | |
application/json | |
None | |
{} | |
{ | |
"test": "yes" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment