WebFinger: Sends a 400 when resource param is missing, fix XRD typo in test
authorHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Sat, 15 Dec 2018 16:34:37 +0000 (17:34 +0100)
committerHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Sat, 15 Dec 2018 16:56:12 +0000 (17:56 +0100)
lib/pleroma/web/web_finger/web_finger_controller.ex
test/web/web_finger/web_finger_controller_test.exs

index 0023531661d0fd5148dd0bfb0200c02cbdd64096..8c60300a49673e26d54b974063ad579612141f22 100644 (file)
@@ -35,4 +35,8 @@ defmodule Pleroma.Web.WebFinger.WebFingerController do
         send_resp(conn, 404, "Unsupported format")
     end
   end
+
+  def webfinger(conn, _params) do
+    send_resp(conn, 400, "Bad Request")
+  end
 end
index cac003e766a2dfc99dd77501551972b44680c11d..3bc878532f0367f41b610d4a7375620f2c7ed615 100644 (file)
@@ -29,9 +29,18 @@ defmodule Pleroma.Web.WebFinger.WebFingerControllerTest do
 
     response =
       build_conn()
-      |> put_req_header("accept", "application/jrd+json")
+      |> put_req_header("accept", "application/xrd+xml")
       |> get("/.well-known/webfinger?resource=acct:#{user.nickname}@localhost")
 
     assert response(response, 200)
   end
+
+  test "Sends a 400 when resource param is missing" do
+    response =
+      build_conn()
+      |> put_req_header("accept", "application/xrd+xml,application/jrd+json")
+      |> get("/.well-known/webfinger")
+
+    assert response(response, 400)
+  end
 end