rdflib.js
rdflib.js copied to clipboard
headers['accept'] does not work on Headers object?
The problem I ran into was that fetch was always sending Accept=*/*
, which meant I was receiving html instead of ttl.
I traced this to the statement https://github.com/linkeddata/rdflib.js/blob/14c93f5cd18fd4658561f243c2f4b3f33a9216df/src/fetcher.ts#L1045
Apparently for a Headers object, we have to use headers.append
, or alternatively just use a plain object?
This seems to be the case in Chrome 83.0.4103.116 (Official Build) (64-bit) (cohort: Stable) and Brave | 1.4.95 Chromium: 80.0.3987.122 (Official Build) (64-bit)
A workaround when using solid is to specify a headers object, e.g.
fetcher.load(folder, {headers: { accept: "text/turtle" }});
This then means that a Headers
object is not used:
https://github.com/linkeddata/rdflib.js/blob/14c93f5cd18fd4658561f243c2f4b3f33a9216df/src/fetcher.ts#L1034