Skip to content

Commit 34ec19d

Browse files
committed
Merge remote commits
1 parent ddbed22 commit 34ec19d

File tree

4 files changed

+13675
-4737
lines changed

4 files changed

+13675
-4737
lines changed

lib/handlers/allow.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ function allow (mode) {
3939
origin: req.get('origin'),
4040
host: req.protocol + '://' + req.get('host'),
4141
fetch: fetchFromLdp(mapper, ldp),
42-
fetchGraph: (uri, contentType) => {
42+
fetchGraph: (uri, options) => {
4343
// first try loading from local fs
44-
return ldp.getGraph(uri, contentType)
44+
return ldp.getGraph(uri, options.contentType)
4545
// failing that, fetch remote graph
46-
.catch(() => ldp.fetchGraph(uri, contentType))
46+
.catch(() => ldp.fetchGraph(uri, options))
4747
},
4848
suffix: ldp.suffixAcl,
4949
strictOrigin: ldp.strictOrigin

lib/ldp.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,11 +309,12 @@ class LDP {
309309
* ```
310310
*
311311
* @param uri {string} Fully qualified uri of the request.
312-
* @param [contentType] {string}
312+
*
313+
* @param [options] {object} Options hashmap, passed through to fetchGraph
313314
*
314315
* @return {Promise<Graph>}
315316
*/
316-
async fetchGraph (uri, contentType = DEFAULT_CONTENT_TYPE) {
317+
async fetchGraph (uri, options) {
317318
const response = await fetch(uri)
318319
if (!response.ok) {
319320
const error = new Error(
@@ -323,6 +324,9 @@ class LDP {
323324
throw error
324325
}
325326
const body = await response.text()
327+
328+
const contentType = options.contentType || DEFAULT_CONTENT_TYPE
329+
326330
return promisify(parse)(body, uri, contentType)
327331
}
328332

0 commit comments

Comments
 (0)