Skip to content

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

@uschindler

Description

@uschindler

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.:

  • Accept: application/vnd.crossref.unixref+xml => returns empty string, should fail with error 406
  • Accept: application/vnd.crossref.unixref+xml, application/vnd.datacite.datacite+xml => returns empty string, but to behave correctly it should return datacite metadata
  • Accept: application/vnd.datacite.datacite+xml, application/vnd.crossref.unixref+xml => returns datacite metadata

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions