jsonld.js icon indicating copy to clipboard operation
jsonld.js copied to clipboard

Allow valid accept headers in document loader options

Open lutangar opened this issue 8 years ago • 1 comments

Hi guys,

Here is a feature that was previously mentioned in #176

The current implementation is far too restrictive on this accept header. The RangeError exception should only be raised when the accept header doesn't contain application/ld+json nor application/json.

This way it could be overridden for more exotic things like application/ld+json, text/html, application/json, that would still be valid.

The point here is to allow valid headers to be used, because at the moment, even if the user specify exactly the default value application/ld+json, application/json the RangeError is raised nonetheless.

Also, even if the buildHeaders function wasn't meant to be exposed, at the moment this is only way to unit test portions of code as there are no builds tools to allow to split things up and require them only where needed. By the way, is there any news/plans on this?

Anyway, what do you think of this feature?

lutangar avatar May 12 '17 14:05 lutangar

@dlongley @davidlehn any feedbacks on this?

lutangar avatar Jun 12 '17 11:06 lutangar