mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Adding route tests
Removing status code from 404 title Removing status code from 503 title Adding id to 503 error box Indatation fix
This commit is contained in:
parent
f6744d3e39
commit
1d5827007f
5 changed files with 21 additions and 11 deletions
|
@ -4,7 +4,7 @@ own modules and imported here. """
|
|||
from http import HTTPStatus
|
||||
from urllib.parse import unquote
|
||||
|
||||
from fastapi import APIRouter, Form, Request
|
||||
from fastapi import APIRouter, Form, Request, HTTPException
|
||||
from fastapi.responses import HTMLResponse, RedirectResponse
|
||||
|
||||
from aurweb.templates import make_context, render_template
|
||||
|
@ -48,3 +48,9 @@ async def index(request: Request):
|
|||
""" Homepage route. """
|
||||
context = make_context(request, "Home")
|
||||
return render_template("index.html", context)
|
||||
|
||||
|
||||
# A route that returns a error 503. For testing purposes.
|
||||
@router.get("/raisefivethree", response_class=HTMLResponse)
|
||||
async def raise_service_unavailable(request: Request):
|
||||
raise HTTPException(status_code=503)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue