jsonld-context-parser.js icon indicating copy to clipboard operation
jsonld-context-parser.js copied to clipboard

support text/plain when json-ld mediatype is not provided

Open EmidioStani opened this issue 3 years ago • 2 comments

Hello,

I was trying to use your library by parsing a remote context on GitHub as raw file. The problem is that by using raw content, GitHub provides text/plain.

So would it possible to parse it as least text/plain when the json-ld mediatype is not provided or let the user decide which mediatype should be looking for.

Thanks,

Emidio

EmidioStani avatar Apr 18 '22 09:04 EmidioStani

In the near term, you could pass a custom fetch function into the constructor, which injects the required content-type in the response header.

But I'm also open to a PR that adds a (non-default) option to pass a custom response content-type override.

rubensworks avatar Apr 19 '22 06:04 rubensworks

This is also relevant when a document exposes itself as the wrong application type.

For example https://w3c.github.io/vc-di-bbs/contexts/v1/ has content-type | application/json; charset=utf-8. This in turn breaks JSON-LD documents stored on a Solid pod, or at least makes them not accessible via tools like Solid Pod Browsers such as Penny ("No permission to access this resource") or via the Firefox RDF Browser extension (Error: Failed to load remote context https://w3id.org/security/bbs/v1: Unsupported JSON-LD media type application/json).

j-steinbach avatar Aug 01 '23 14:08 j-steinbach