crosscite / content-negotiation

DOI content negotiation
https://data.crosscite.org
MIT License
3 stars 4 forks source link

Content negotiation with crossref media type returns empty document instead of error 406 #109

Open uschindler opened 2 years ago

uschindler commented 2 years ago

When doing content negotiation with the Crossref UNIXREF content type (application/vnd.crossref.unixref+xml) as first Accept header, the datacite service returns an empty string.

It should respond with error code 406 ("not acceptable") and not return empty metadata if it can't support the metadata.

This breaks content negotitaion on DOIs when you request both types (crossref and datacite), e.g.:

The workaround is to use the last variant for your Accept header, because then datacite metadata has slightly higher precedence. Zotero is doing this (see https://github.com/zotero/translators/blob/151e9fb702dd9e6908329fbab212bb9b6ca61f55/DOI%20Content%20Negotiation.js#L123), but the order should really not matter at all!

The reason for this behaviour seems to be some commented out code (it looks like DataCite wanted to support UNIXREF at some point) which then returns nothing. Actually the ":crossref" type in the code should be completely removed from the request controller.