@@ -76,7 +76,9 @@ function handler (req, res, next) {
7676 // Till here it must exist
7777 if ( ! includeBody ) {
7878 debug ( 'HEAD only' )
79- res . sendStatus ( 200 )
79+ contentType = mime . contentType ( _path . extname ( path ) )
80+ res . setHeader ( 'Content-Type' , contentType )
81+ res . status ( 200 ) . send ( 'OK' )
8082 return next ( )
8183 }
8284
@@ -85,8 +87,8 @@ function handler (req, res, next) {
8587 let mimeTypeByExt = mime . lookup ( _path . basename ( path ) )
8688 let isHtmlResource = mimeTypeByExt && mimeTypeByExt . includes ( 'html' )
8789 let useDataBrowser = ldp . dataBrowserPath && (
88- container ||
89- RDFs . includes ( contentType ) && ! isHtmlResource && ! ldp . suppressDataBrowser )
90+ container ||
91+ RDFs . includes ( contentType ) && ! isHtmlResource && ! ldp . suppressDataBrowser )
9092
9193 if ( useDataBrowser ) {
9294 res . set ( 'Content-Type' , 'text/html' )
@@ -160,7 +162,7 @@ function globHandler (req, res, next) {
160162 debugGlob ( 'found matches ' + matches )
161163 Promise . all ( matches . map ( match => new Promise ( ( resolve , reject ) => {
162164 const baseUri = reqOrigin + '/' + match . substr ( root . length )
163- fs . readFile ( match , { encoding : 'utf8' } , function ( err , fileData ) {
165+ fs . readFile ( match , { encoding : 'utf8' } , function ( err , fileData ) {
164166 if ( err ) {
165167 debugGlob ( 'error ' + err )
166168 return resolve ( )
@@ -182,15 +184,15 @@ function globHandler (req, res, next) {
182184 } )
183185 } )
184186 } ) ) )
185- . then ( ( ) => {
186- const data = $rdf . serialize ( undefined , globGraph , requestUri , 'text/turtle' )
187- // TODO this should be added as a middleware in the routes
188- res . setHeader ( 'Content-Type' , 'text/turtle' )
189- debugGlob ( 'returning turtle' )
190-
191- res . send ( data )
192- return next ( )
193- } )
187+ . then ( ( ) => {
188+ const data = $rdf . serialize ( undefined , globGraph , requestUri , 'text/turtle' )
189+ // TODO this should be added as a middleware in the routes
190+ res . setHeader ( 'Content-Type' , 'text/turtle' )
191+ debugGlob ( 'returning turtle' )
192+
193+ res . send ( data )
194+ return next ( )
195+ } )
194196 } )
195197}
196198
0 commit comments