Comparing version 5.2.0 to 6.0.0
@@ -83,2 +83,3 @@ /* | ||
doc = {contextUrl: null, documentUrl: url, document: body || null}; | ||
// handle error | ||
@@ -96,3 +97,5 @@ const statusText = http.STATUS_CODES[res.status]; | ||
const link = res.headers.get('link'); | ||
let location = res.headers.get('location'); | ||
const contentType = res.headers.get('content-type'); | ||
// handle Link Header | ||
@@ -115,3 +118,3 @@ if(link && contentType !== 'application/ld+json') { | ||
// "alternate" link header is a redirect | ||
alternate = linkHeaders['alternate']; | ||
alternate = linkHeaders.alternate; | ||
if(alternate && | ||
@@ -121,6 +124,6 @@ alternate.type == 'application/ld+json' && | ||
.match(/^application\/(\w*\+)?json$/)) { | ||
res.headers.set('location', prependBase(url, alternate.target)); | ||
location = prependBase(url, alternate.target); | ||
} | ||
} | ||
const location = res.headers.get('location'); | ||
// handle redirect | ||
@@ -150,3 +153,5 @@ if((alternate || | ||
redirects.push(url); | ||
return loadDocument(location, redirects); | ||
// location can be relative, turn into full url | ||
const nextUrl = new URL(location, url).href; | ||
return loadDocument(nextUrl, redirects); | ||
} | ||
@@ -171,3 +176,8 @@ | ||
try { | ||
const options = {headers, redirect: 'manual'}; | ||
const options = { | ||
headers, | ||
redirect: 'manual', | ||
// ky specific to avoid redirects throwing | ||
throwHttpErrors: false | ||
}; | ||
const isHttps = url.startsWith('https:'); | ||
@@ -174,0 +184,0 @@ if(isHttps) { |
@@ -93,3 +93,3 @@ /* | ||
// "alternate" link header is a redirect | ||
alternate = linkHeaders['alternate']; | ||
alternate = linkHeaders.alternate; | ||
if(alternate && | ||
@@ -96,0 +96,0 @@ alternate.type == 'application/ld+json' && |
@@ -133,3 +133,3 @@ /* | ||
} | ||
const rel = result['rel'] || ''; | ||
const rel = result.rel || ''; | ||
if(Array.isArray(rval[rel])) { | ||
@@ -136,0 +136,0 @@ rval[rel].push(result); |
{ | ||
"name": "jsonld", | ||
"version": "5.2.0", | ||
"version": "6.0.0", | ||
"description": "A JSON-LD Processor and API implementation in JavaScript.", | ||
@@ -32,3 +32,3 @@ "homepage": "https://github.com/digitalbazaar/jsonld.js", | ||
"dependencies": { | ||
"@digitalbazaar/http-client": "^1.1.0", | ||
"@digitalbazaar/http-client": "^3.2.0", | ||
"canonicalize": "^1.0.1", | ||
@@ -82,3 +82,3 @@ "lru-cache": "^6.0.0", | ||
"engines": { | ||
"node": ">=12" | ||
"node": ">=14" | ||
}, | ||
@@ -94,3 +94,3 @@ "keywords": [ | ||
"scripts": { | ||
"prepublish": "npm run build", | ||
"prepack": "npm run build", | ||
"build": "npm run build-webpack", | ||
@@ -110,3 +110,3 @@ "build-webpack": "webpack", | ||
"coverage-report": "nyc report", | ||
"lint": "eslint *.js lib/**.js tests/**.js" | ||
"lint": "eslint ." | ||
}, | ||
@@ -113,0 +113,0 @@ "nyc": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2692417
19931
34
+ Added@digitalbazaar/http-client@3.4.1(transitive)
+ Added@fastify/busboy@2.1.1(transitive)
+ Addeddata-uri-to-buffer@4.0.1(transitive)
+ Addedfetch-blob@3.2.0(transitive)
+ Addedformdata-polyfill@4.0.10(transitive)
+ Addedky@0.33.3(transitive)
+ Addedky-universal@0.11.0(transitive)
+ Addednode-domexception@1.0.0(transitive)
+ Addednode-fetch@3.3.2(transitive)
+ Addedundici@5.28.4(transitive)
+ Addedweb-streams-polyfill@3.3.3(transitive)
- Removed@digitalbazaar/http-client@1.2.0(transitive)
- Removeddata-uri-to-buffer@3.0.1(transitive)
- Removedesm@3.2.25(transitive)
- Removedfetch-blob@2.1.2(transitive)
- Removedky@0.25.1(transitive)
- Removedky-universal@0.8.2(transitive)
- Removednode-fetch@3.0.0-beta.9(transitive)