server/embed: return 404 on post not found

This commit is contained in:
Eva 2024-03-21 02:23:42 +01:00
parent a88e73804c
commit 922499cb64
2 changed files with 2 additions and 2 deletions

View file

@ -81,7 +81,7 @@ def post_index(ctx: rest.Context, params: Dict[str, str]) -> rest.Response:
try:
oembed = get_post(ctx, {}, path)
except posts.PostNotFoundError:
return {"return_type": "custom", "content": index_html}
return {"return_type": "custom", "status_code": "404", "content": index_html}
url = config.config["site_url"] + path
new_html = index_html.replace("</head>", f'''

View file

@ -113,7 +113,7 @@ def application(
db.session.remove()
if type(response) == dict and response.get("return_type") == "custom":
start_response("200", [("content-type", "text/html")])
start_response(response.get("status_code", "200"), [("content-type", "text/html")])
return (response.get("content", "").encode("utf-8"),)
start_response("200", [("content-type", "application/json")])