mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Correct syntax for link headers, closes #2470
This commit is contained in:
parent
6e512caa59
commit
333f786cb0
6 changed files with 7 additions and 7 deletions
|
|
@ -158,7 +158,7 @@ class BaseView:
|
|||
template_context["alternate_url_json"] = alternate_url_json
|
||||
headers.update(
|
||||
{
|
||||
"Link": '{}; rel="alternate"; type="application/json+datasette"'.format(
|
||||
"Link": '<{}>; rel="alternate"; type="application/json+datasette"'.format(
|
||||
alternate_url_json
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ class DatabaseView(View):
|
|||
view_name="database",
|
||||
),
|
||||
headers={
|
||||
"Link": '{}; rel="alternate"; type="application/json+datasette"'.format(
|
||||
"Link": '<{}>; rel="alternate"; type="application/json+datasette"'.format(
|
||||
alternate_url_json
|
||||
)
|
||||
},
|
||||
|
|
@ -630,7 +630,7 @@ class QueryView(View):
|
|||
data = {}
|
||||
headers.update(
|
||||
{
|
||||
"Link": '{}; rel="alternate"; type="application/json+datasette"'.format(
|
||||
"Link": '<{}>; rel="alternate"; type="application/json+datasette"'.format(
|
||||
alternate_url_json
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -894,7 +894,7 @@ async def table_view_traced(datasette, request):
|
|||
)
|
||||
headers.update(
|
||||
{
|
||||
"Link": '{}; rel="alternate"; type="application/json+datasette"'.format(
|
||||
"Link": '<{}>; rel="alternate"; type="application/json+datasette"'.format(
|
||||
alternate_url_json
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -457,7 +457,7 @@ You can find this near the top of the source code of those pages, looking like t
|
|||
|
||||
The JSON URL is also made available in a ``Link`` HTTP header for the page::
|
||||
|
||||
Link: https://latest.datasette.io/fixtures/sortable.json; rel="alternate"; type="application/json+datasette"
|
||||
Link: <https://latest.datasette.io/fixtures/sortable.json>; rel="alternate"; type="application/json+datasette"
|
||||
|
||||
.. _json_api_cors:
|
||||
|
||||
|
|
|
|||
|
|
@ -433,7 +433,7 @@ def test_canned_write_custom_template(canned_write_client):
|
|||
)
|
||||
assert (
|
||||
response.headers["link"]
|
||||
== 'http://localhost/data/update_name.json; rel="alternate"; type="application/json+datasette"'
|
||||
== '<http://localhost/data/update_name.json>; rel="alternate"; type="application/json+datasette"'
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1040,7 +1040,7 @@ async def test_alternate_url_json(ds_client, path, expected):
|
|||
response = await ds_client.get(path)
|
||||
assert response.status_code == 200
|
||||
link = response.headers["link"]
|
||||
assert link == '{}; rel="alternate"; type="application/json+datasette"'.format(
|
||||
assert link == '<{}>; rel="alternate"; type="application/json+datasette"'.format(
|
||||
expected
|
||||
)
|
||||
assert (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue