ryu/app/wsapi: make json_parse_message_body work
json_parse_message_body() didn't work. This patch fixes it. > File "ryu/app/wsapi.py", line 129, in json_parse_message_body > content = request.content.read() > AttributeError: WSRequest instance has no attribute 'content' > Traceback (most recent call last): Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
54bdba9349
commit
49214f61ee
@ -499,8 +499,10 @@ class WSRequest:
|
||||
self.env = env
|
||||
self.start_response = start_response
|
||||
self.version = None
|
||||
self.content = env.get('wsgi.input', None)
|
||||
|
||||
req = Request(env)
|
||||
self.req = req
|
||||
self.method = req.method
|
||||
self.path = req.path
|
||||
self.segs = [s for s in self.path.split('/') if s]
|
||||
@ -523,6 +525,9 @@ class WSRequest:
|
||||
def setHeader(self, name, value):
|
||||
self.rsp.headers[name] = value
|
||||
|
||||
def getHeader(self, name):
|
||||
return self.req.headers[name]
|
||||
|
||||
def setResponseCode(self, code, message=None):
|
||||
if not isinstance(code, (int, long)):
|
||||
raise TypeError("HTTP response code must be int or long")
|
||||
|
Loading…
x
Reference in New Issue
Block a user