Skip to content
Browse files

Adding example using secure cookies

  • Loading branch information...
1 parent 3c3d775 commit 35a37df952f12e0fcb4a67e486574ee083fd7993 @puentesarrin puentesarrin committed with
Showing with 16 additions and 0 deletions.
  1. +16 −0 examples/http_secure_cookie_support.py
View
16 examples/http_secure_cookie_support.py
@@ -0,0 +1,16 @@
+# -*- coding: utf-8 *-*
+from itty import *
+
+@get('/receive')
+def receive_cookies(request):
+ response = Response(str(request.get_secure_cookie('foo')),
+ content_type='text/plain')
+ return response
+
+@get('/send')
+def response_cookies(request):
+ response = Response('Check your cookies.')
+ response.set_secure_cookie('foo', 'bar')
+ return response
+
+run_itty(cookie_secret='MySeCrEtCoOkIe')

0 comments on commit 35a37df

Please sign in to comment.
Something went wrong with that request. Please try again.