Skip to content

Commit d83c623

Browse files
authored
[ENG-10167] 2.1.6 BE: add link header to guid metadata endpoints (#11594)
* add link header to guid metadata endpoints for registry and project * update code
1 parent 9fc1c84 commit d83c623

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

website/views.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,4 +423,8 @@ def guid_metadata_download(guid, resource, metadata_format):
423423
def metadata_download(guid):
424424
format_arg = request.args.get('format', 'datacite-json')
425425
resource = Guid.load(guid)
426-
return guid_metadata_download(guid, resource=resource, metadata_format=format_arg)
426+
is_resource_project_or_registration = isinstance(resource.referent, (Node, Registration))
427+
response = guid_metadata_download(guid, resource=resource, metadata_format=format_arg)
428+
if is_resource_project_or_registration:
429+
response.headers['link'] = f'<{settings.DOMAIN}{guid}/>; rel="describes"; type="text/html"'
430+
return response

0 commit comments

Comments
 (0)