Support /.well-known/host-meta.json (#32206)
This commit is contained in:
parent
f0716368e6
commit
33d3ca7cf1
4 changed files with 55 additions and 14 deletions
|
@ -9,19 +9,39 @@ RSpec.describe 'The /.well-known/host-meta request' do
|
|||
expect(response)
|
||||
.to have_http_status(200)
|
||||
.and have_attributes(
|
||||
media_type: 'application/xrd+xml',
|
||||
body: host_meta_xml_template
|
||||
media_type: 'application/xrd+xml'
|
||||
)
|
||||
|
||||
doc = Nokogiri::XML(response.parsed_body)
|
||||
expect(doc.at_xpath('/xrd:XRD/xrd:Link[@rel="lrdd"]/@template', 'xrd' => 'http://docs.oasis-open.org/ns/xri/xrd-1.0').value)
|
||||
.to eq 'https://cb6e6126.ngrok.io/.well-known/webfinger?resource={uri}'
|
||||
end
|
||||
|
||||
it 'returns http success with valid JSON response with .json extension' do
|
||||
get '/.well-known/host-meta.json'
|
||||
|
||||
expect(response)
|
||||
.to have_http_status(200)
|
||||
.and have_attributes(
|
||||
media_type: 'application/json'
|
||||
)
|
||||
|
||||
expect(response.parsed_body)
|
||||
.to include(
|
||||
links: [
|
||||
'rel' => 'lrdd',
|
||||
'template' => 'https://cb6e6126.ngrok.io/.well-known/webfinger?resource={uri}',
|
||||
]
|
||||
)
|
||||
end
|
||||
|
||||
private
|
||||
it 'returns http success with valid JSON response with Accept header' do
|
||||
get '/.well-known/host-meta', headers: { 'Accept' => 'application/json' }
|
||||
|
||||
def host_meta_xml_template
|
||||
<<~XML
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0">
|
||||
<Link rel="lrdd" template="https://cb6e6126.ngrok.io/.well-known/webfinger?resource={uri}"/>
|
||||
</XRD>
|
||||
XML
|
||||
expect(response)
|
||||
.to have_http_status(200)
|
||||
.and have_attributes(
|
||||
media_type: 'application/json'
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue