You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 17, 2024. It is now read-only.
An error has occured in one of your routes.
Detail: test.nim(45) test
asyncdispatch.nim(1507) runForever
asyncdispatch.nim(1511) poll
asyncdispatch.nim(1277) runOnce
asyncdispatch.nim(183) processPendingCallbacks
asyncmacro.nim(37) processRequest_continue
asynchttpserver.nim(143) processRequestIter
jester.nim(350) :anonymous
jester.nim(321) handleHTTPRequest
asyncmacro.nim(401) handleRequest
asyncmacro.nim(34) handleRequest_continue
jester.nim(283) handleRequestIter
asyncmacro.nim(401) match
asyncmacro.nim(34) match_continue
test.nim(21) matchIter
httpcore.nim(130) []
tables.nim(405) []
tables.nim(151) []
key not found: set-cookie
here is code.
import asyncdispatch,
httpauth,
jester,
json,
strutils
# Create a backend as needed and an HTTPAuth instancelet backend =newSQLBackend("sqlite://./auth.sqlite3")
var auth =newHTTPAuth("MyIPAddress", backend, https_only_cookies=false)
# Create admin user - you need to run this only once
auth.initialize_admin_user(password="demo")
routes:
post"/login":
## Perform login#auth.headers_hook(request.headers)try:
auth.login(@"username", @"password")
# move set-cookie to right place - FIXME
response.data[2]["Set-Cookie"] = request.headers["set-cookie"]
resp"Success"exceptLoginError:
resp"Failed"get"/logout":
## Logout
auth.headers_hook(request.headers)
try:
auth.logout()
# move set-cookie to right place - FIXMEif request.headers.hasKey("set-cookie"):
response.data[2]["Set-Cookie"] = request.headers["set-cookie"]
resp"Success"exceptAuthError:
resp"Failed"get"/private":
## Only authenticated users can see this
auth.headers_hook(request.headers)
try:
auth.require()
exceptAuthError:
resp"Sorry, you are not authorized."resp"""Welcome! <a href="/admin">Admin page</a> <a href="/logout">Logout</a>"""runForever()
:(
here is code.
The text was updated successfully, but these errors were encountered: