@solid-rest/core
Advanced tools
Comparing version 2.1.10 to 2.1.11
@@ -126,25 +126,27 @@ "use strict"; | ||
let $rdf = typeof window != "undefined" && window.$rdf ? window.$rdf : typeof global != "undefined" && global.$rdf ? global.$rdf : null; | ||
async function serialize(uri, body, informat, outformat) { | ||
return new Promise(async (resolve, reject) => { | ||
let u = $rdf.sym(uri); | ||
let kb = $rdf.graph(); | ||
await $rdf.parse(body, kb, uri, informat); | ||
$rdf.serialize(u, kb, uri, outformat, (err, str) => { | ||
if (err) return reject(err);else return resolve(str); | ||
}); | ||
}); | ||
} | ||
let accept = this.request.headers.accept || ""; | ||
accept = accept && accept.match && accept.match(/ /) ? "" : accept; | ||
if (this.patch && accept && accept.match) { | ||
if (accept.match(/(text\/turtle|application\/ld\+json)/)) { | ||
body = await serialize(this.request.url, body.toString(), this.item.contentType, accept); | ||
} else { | ||
headers.status = "405"; | ||
headers.statusText = `Unsupported content-type in accept header : ${accept}`; | ||
/* | ||
async function serialize(uri,body,informat,outformat){ | ||
return new Promise( async (resolve,reject)=>{ | ||
let u = $rdf.sym(uri); | ||
let kb = $rdf.graph(); | ||
await $rdf.parse(body, kb, uri, informat); | ||
$rdf.serialize(u, kb, uri,outformat,(err, str)=>{ | ||
if(err) return( reject(err) ); | ||
else return( resolve(str) ); | ||
}); | ||
}) | ||
} | ||
} | ||
let accept = this.request.headers.accept || ""; | ||
accept = accept && accept.match && accept.match(/ /) ?"" :accept; | ||
if(this.patch && accept && accept.match){ | ||
if( accept.match(/(text\/turtle|application\/ld\+json)/) ){ | ||
body = await serialize(this.request.url,body.toString(),this.item.contentType,accept) | ||
} | ||
else { | ||
headers.status = "405"; | ||
headers.statusText = `Unsupported content-type in accept header : ${accept}`; | ||
} | ||
} | ||
*/ | ||
@@ -151,0 +153,0 @@ headers.statusText = headers.statusText || statusText[headers.status]; |
@@ -116,25 +116,27 @@ /* | ||
let $rdf = typeof window != "undefined" && window.$rdf ? window.$rdf : typeof global != "undefined" && global.$rdf ? global.$rdf : null; | ||
async function serialize(uri, body, informat, outformat) { | ||
return new Promise(async (resolve, reject) => { | ||
let u = $rdf.sym(uri); | ||
let kb = $rdf.graph(); | ||
await $rdf.parse(body, kb, uri, informat); | ||
$rdf.serialize(u, kb, uri, outformat, (err, str) => { | ||
if (err) return reject(err);else return resolve(str); | ||
}); | ||
}); | ||
} | ||
let accept = this.request.headers.accept || ""; | ||
accept = accept && accept.match && accept.match(/ /) ? "" : accept; | ||
if (this.patch && accept && accept.match) { | ||
if (accept.match(/(text\/turtle|application\/ld\+json)/)) { | ||
body = await serialize(this.request.url, body.toString(), this.item.contentType, accept); | ||
} else { | ||
headers.status = "405"; | ||
headers.statusText = `Unsupported content-type in accept header : ${accept}`; | ||
/* | ||
async function serialize(uri,body,informat,outformat){ | ||
return new Promise( async (resolve,reject)=>{ | ||
let u = $rdf.sym(uri); | ||
let kb = $rdf.graph(); | ||
await $rdf.parse(body, kb, uri, informat); | ||
$rdf.serialize(u, kb, uri,outformat,(err, str)=>{ | ||
if(err) return( reject(err) ); | ||
else return( resolve(str) ); | ||
}); | ||
}) | ||
} | ||
} | ||
let accept = this.request.headers.accept || ""; | ||
accept = accept && accept.match && accept.match(/ /) ?"" :accept; | ||
if(this.patch && accept && accept.match){ | ||
if( accept.match(/(text\/turtle|application\/ld\+json)/) ){ | ||
body = await serialize(this.request.url,body.toString(),this.item.contentType,accept) | ||
} | ||
else { | ||
headers.status = "405"; | ||
headers.statusText = `Unsupported content-type in accept header : ${accept}`; | ||
} | ||
} | ||
*/ | ||
@@ -141,0 +143,0 @@ headers.statusText = headers.statusText || statusText[headers.status]; |
@@ -135,25 +135,27 @@ (function (global, factory) { | ||
let $rdf = typeof window != "undefined" && window.$rdf ? window.$rdf : typeof global != "undefined" && global.$rdf ? global.$rdf : null; | ||
async function serialize(uri, body, informat, outformat) { | ||
return new Promise(async (resolve, reject) => { | ||
let u = $rdf.sym(uri); | ||
let kb = $rdf.graph(); | ||
await $rdf.parse(body, kb, uri, informat); | ||
$rdf.serialize(u, kb, uri, outformat, (err, str) => { | ||
if (err) return reject(err);else return resolve(str); | ||
}); | ||
}); | ||
} | ||
let accept = this.request.headers.accept || ""; | ||
accept = accept && accept.match && accept.match(/ /) ? "" : accept; | ||
if (this.patch && accept && accept.match) { | ||
if (accept.match(/(text\/turtle|application\/ld\+json)/)) { | ||
body = await serialize(this.request.url, body.toString(), this.item.contentType, accept); | ||
} else { | ||
headers.status = "405"; | ||
headers.statusText = `Unsupported content-type in accept header : ${accept}`; | ||
/* | ||
async function serialize(uri,body,informat,outformat){ | ||
return new Promise( async (resolve,reject)=>{ | ||
let u = $rdf.sym(uri); | ||
let kb = $rdf.graph(); | ||
await $rdf.parse(body, kb, uri, informat); | ||
$rdf.serialize(u, kb, uri,outformat,(err, str)=>{ | ||
if(err) return( reject(err) ); | ||
else return( resolve(str) ); | ||
}); | ||
}) | ||
} | ||
} | ||
let accept = this.request.headers.accept || ""; | ||
accept = accept && accept.match && accept.match(/ /) ?"" :accept; | ||
if(this.patch && accept && accept.match){ | ||
if( accept.match(/(text\/turtle|application\/ld\+json)/) ){ | ||
body = await serialize(this.request.url,body.toString(),this.item.contentType,accept) | ||
} | ||
else { | ||
headers.status = "405"; | ||
headers.statusText = `Unsupported content-type in accept header : ${accept}`; | ||
} | ||
} | ||
*/ | ||
@@ -160,0 +162,0 @@ headers.statusText = headers.statusText || statusText[headers.status]; |
{ | ||
"name": "@solid-rest/core", | ||
"version": "2.1.10", | ||
"version": "2.1.11", | ||
"author": "Jeff Zucker", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -115,2 +115,4 @@ /* | ||
let $rdf = typeof window != "undefined" && window.$rdf ? window.$rdf : typeof global != "undefined" && global.$rdf ? global.$rdf : null; | ||
/* | ||
async function serialize(uri,body,informat,outformat){ | ||
@@ -127,2 +129,3 @@ return new Promise( async (resolve,reject)=>{ | ||
} | ||
let accept = this.request.headers.accept || ""; | ||
@@ -139,3 +142,3 @@ accept = accept && accept.match && accept.match(/ /) ?"" :accept; | ||
} | ||
*/ | ||
headers.statusText = headers.statusText || statusText[headers.status]; | ||
@@ -142,0 +145,0 @@ |
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
167065
4240