forked from AkkomaGang/akkoma
Merge branch 'bugfix/webfinger-jrd' into 'develop'
Fix requesting application/jrd+json on webfinger See merge request pleroma/pleroma!553
This commit is contained in:
commit
8cb9580aec
2 changed files with 38 additions and 0 deletions
|
@ -65,6 +65,7 @@
|
||||||
config :mime, :types, %{
|
config :mime, :types, %{
|
||||||
"application/xml" => ["xml"],
|
"application/xml" => ["xml"],
|
||||||
"application/xrd+xml" => ["xrd+xml"],
|
"application/xrd+xml" => ["xrd+xml"],
|
||||||
|
"application/jrd+json" => ["jrd+json"],
|
||||||
"application/activity+json" => ["activity+json"],
|
"application/activity+json" => ["activity+json"],
|
||||||
"application/ld+json" => ["activity+json"]
|
"application/ld+json" => ["activity+json"]
|
||||||
}
|
}
|
||||||
|
|
37
test/web/web_finger/web_finger_controller_test.exs
Normal file
37
test/web/web_finger/web_finger_controller_test.exs
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
defmodule Pleroma.Web.WebFinger.WebFingerControllerTest do
|
||||||
|
use Pleroma.Web.ConnCase
|
||||||
|
|
||||||
|
alias Pleroma.User
|
||||||
|
alias Pleroma.Web.WebFinger.WebFingerController
|
||||||
|
|
||||||
|
import Pleroma.Factory
|
||||||
|
import ExUnit.CaptureLog
|
||||||
|
import Tesla.Mock
|
||||||
|
|
||||||
|
setup do
|
||||||
|
mock(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
||||||
|
:ok
|
||||||
|
end
|
||||||
|
|
||||||
|
test "Webfinger JRD" do
|
||||||
|
user = insert(:user)
|
||||||
|
|
||||||
|
response =
|
||||||
|
build_conn()
|
||||||
|
|> put_req_header("accept", "application/jrd+json")
|
||||||
|
|> get("/.well-known/webfinger?resource=acct:#{user.nickname}@localhost")
|
||||||
|
|
||||||
|
assert json_response(response, 200)["subject"] == "acct:#{user.nickname}@localhost"
|
||||||
|
end
|
||||||
|
|
||||||
|
test "Webfinger XML" do
|
||||||
|
user = insert(:user)
|
||||||
|
|
||||||
|
response =
|
||||||
|
build_conn()
|
||||||
|
|> put_req_header("accept", "application/jrd+json")
|
||||||
|
|> get("/.well-known/webfinger?resource=acct:#{user.nickname}@localhost")
|
||||||
|
|
||||||
|
assert response(response, 200)
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue