Skip to content
This repository was archived by the owner on Jun 22, 2023. It is now read-only.

feat(json-ld): Return error if document lang doesn't match accept-lang #169

Merged
merged 1 commit into from
Apr 9, 2021

Conversation

alastair
Copy link
Member

As discussed to add to D2.3

if lang is set and accept-lang is set and they're equal, return the document
if they're both set and different, return an error
if lang is null and no accept-lang set, return the document
If lang is null and accept-lang is set, return an error (pending to determine if this should be an error or success)

waiting for @musicog to tell us what the http status code should be, it shouldn't be 400.

@alastair
Copy link
Member Author

Missing one functionality listed in the document:

The Accept-Language header can contain multiple language codes in order of priority. Results will be filtered for the first priority language

Should we accept multiple language codes and return the document if its language is any of these?

@alastair
Copy link
Member Author

This should return HTTP406 in the case that it cannot serve the request.

We should also handle more detailed accept-language headers, such as:
Accept-Language: fr-CH, fr;q=0.9, en;q=0.8, de;q=0.7, *;q=0.5

ignore priorities, reduce lang-locale down to lang (fr-CH -> fr), and accept * as a wildcard that matches any language or null.

If a list is given, return the document if its language is any of the items in the list

If a node's language is null and a language is given, return 406.

@alastair
Copy link
Member Author

alastair commented Apr 2, 2021

I updated this to check a more detailed Accept-Language header, and to return HTTP406 if the languages don't match.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants