Add no-cache option as standard to functionality for readRDF -> loadRDF #14

Merged
jsheunis merged 1 commit from caching into main 2025-10-05 08:42:34 +00:00
2 changed files with 10 additions and 3 deletions

View file

@ -1,6 +1,6 @@
{
"name": "shacl-tulip",
"version": "0.0.6",
"version": "0.0.7",
"type": "module",
"main": "./src/index.js",
"module": "./src/index.js",

View file

@ -18,14 +18,21 @@ export async function readRDF(file_url, headers = { "Content-Type": "text/turtle
res = await fetch(url,
{
formats,
headers: headers
headers: headers,
cache: 'no-cache',
}
)
// Handle cases where the server returns generic 'text/plain' or 'text/html' content type
if (['text/plain', 'text/html'].indexOf(res.headers.get('content-type')) >= 0) {
// default to turtle
headers['Content-Type'] = 'text/turtle';
res = await fetch(url, { formats, headers });
res = await fetch(url,
{
formats,
headers: headers,
cache: 'no-cache',
}
);
}
if (!res.ok) {