MCPcopy Index your code
hub / github.com/hugapi/hug / process_response

Method process_response

hug/middleware.py:92–108  ·  view source on GitHub ↗

Save request context in coupled store object. Set cookie containing a session ID.

(self, request, response, resource, req_succeeded)

Source from the content-addressed store, hash-verified

90 request.context.update({self.context_name: data})
91
92 def process_response(self, request, response, resource, req_succeeded):
93 """Save request context in coupled store object. Set cookie containing a session ID."""
94 sid = request.cookies.get(self.cookie_name, None)
95 if sid is None or not self.store.exists(sid):
96 sid = self.generate_sid()
97
98 self.store.set(sid, request.context.get(self.context_name, {}))
99 response.set_cookie(
100 self.cookie_name,
101 sid,
102 expires=self.cookie_expires,
103 max_age=self.cookie_max_age,
104 domain=self.cookie_domain,
105 path=self.cookie_path,
106 secure=self.cookie_secure,
107 http_only=self.cookie_http_only,
108 )
109
110
111class LogMiddleware(object):

Callers

nothing calls this directly

Calls 4

generate_sidMethod · 0.95
existsMethod · 0.80
setMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected