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 <[email protected]>
---
 ryu/app/wsapi.py |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/ryu/app/wsapi.py b/ryu/app/wsapi.py
index 3659e86..9678a0d 100644
--- a/ryu/app/wsapi.py
+++ b/ryu/app/wsapi.py
@@ -501,8 +501,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]
@@ -525,6 +527,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")
-- 
1.7.1.1


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to