Skip to content

Commit

Permalink
Set status code to 403
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxbro committed Nov 5, 2024
1 parent 781731d commit c3b3f8c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions panel/io/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,7 @@ async def get(self, *args, **kwargs):
if authorized is None:
return
elif not authorized:
self.set_status(403)
page = self._render_auth_error(auth_error)
self.set_header("Content-Type", 'text/html')
self.write(page)
Expand Down
3 changes: 2 additions & 1 deletion panel/tests/command/test_serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,5 +196,6 @@ def auth(userinfo):
with run_panel_serve(["--port", "0", py, "--setup", setup_py], cwd=tmp_path) as p:
nsbr = NBSR(p.stdout)
port = wait_for_port(nsbr)
requests.get(f"http://localhost:{port}/")
resp = requests.get(f"http://localhost:{port}/")
wait_for_regex(nsbr, regex=regex)
assert resp.status_code == 403

0 comments on commit c3b3f8c

Please sign in to comment.