Skip to content

Commit

Permalink
add wsgi/twisted bridge methods for HttpTransportContext. arskom#446
Browse files Browse the repository at this point in the history
  • Loading branch information
plq committed Jul 28, 2015
1 parent 66f7a49 commit ea72d87
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions spyne/server/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ def respond(self, resp_code, **kwargs):
def get_path(self):
raise NotImplementedError()

def get_request_method(self):
raise NotImplementedError()

def get_request_content_type(self):
raise NotImplementedError()

def get_path_and_qs(self):
raise NotImplementedError()

Expand Down
6 changes: 6 additions & 0 deletions spyne/server/twisted/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,12 @@ def get_path(self):
def get_path_and_qs(self):
return self.req.uri

def get_request_method(self):
return self.req.method

def get_request_content_type(self):
return self.req.getHeader("Content-Type")


class TwistedHttpMethodContext(HttpMethodContext):
default_transport_context = TwistedHttpTransportContext
Expand Down
6 changes: 6 additions & 0 deletions spyne/server/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@ def get_cookie(self, key):

return cookie.get(key, None).value

def get_request_method(self):
return self.req['REQUEST_METHOD'].upper()

def get_request_content_type(self):
return self.req.get("CONTENT_TYPE", None)


class WsgiMethodContext(HttpMethodContext):
"""The WSGI-Specific method context. WSGI-Specific information is stored in
Expand Down

0 comments on commit ea72d87

Please # to comment.