diff options
author | Aaron Tinio <aptinio@gmail.com> | 2019-05-21 09:40:29 +0800 |
---|---|---|
committer | Aaron Tinio <aptinio@gmail.com> | 2019-05-22 07:15:52 +0800 |
commit | 3ab9255eda21a5f8a25047375af9608e0c0c7592 (patch) | |
tree | 9a9c8d3f668673e40e0fa1226b0d7a2807bfc772 /lib | |
parent | a13d449b241b6e5fa14fb741694e63cd21569b2c (diff) | |
download | pleroma-3ab9255eda21a5f8a25047375af9608e0c0c7592.tar.gz |
Respond with a 404 Not implemented JSON error message
when requested API is not implemented
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/router.ex | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index 4c29b24eb..49e28cc2d 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -710,6 +710,7 @@ defmodule Pleroma.Web.Router do scope "/", Fallback do get("/registration/:token", RedirectController, :registration_page) get("/:maybe_nickname_or_id", RedirectController, :redirector_with_meta) + get("/api*path", RedirectController, :api_not_implemented) get("/*path", RedirectController, :redirector) options("/*path", RedirectController, :empty) @@ -721,6 +722,12 @@ defmodule Fallback.RedirectController do alias Pleroma.User alias Pleroma.Web.Metadata + def api_not_implemented(conn, _params) do + conn + |> put_status(404) + |> json(%{error: "Not implemented"}) + end + def redirector(conn, _params, code \\ 200) do conn |> put_resp_content_type("text/html") |