File tree Expand file tree Collapse file tree 4 files changed +13675
-4737
lines changed
Expand file tree Collapse file tree 4 files changed +13675
-4737
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments