Skip to content

Commit 8a84397

Browse files
author
deiu
committed
Load skin (mashlib) if requesting text/html
1 parent 1a706d4 commit 8a84397

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

lib/handlers/get.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,11 @@ function handler (req, res, next) {
7878
var address = req.protocol + '/' + req.get('host') + req.originalUrl
7979
return res.redirect(303, ldp.defaultApp + address)
8080
}
81-
// Serve (pipe) resource as requested
82-
res.setHeader('Content-Type', contentType)
83-
return stream.pipe(res)
81+
82+
res.set('Content-Type', 'text/html')
83+
var skin = _path.join(__dirname, '../../static/skin.html')
84+
res.sendFile(skin)
85+
return
8486
}
8587

8688
// If request accepts the content-type we found

test/http.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,16 @@ describe('HTTP APIs', function () {
208208
.expect('Link', /<http:\/\/www.w3.org\/ns\/ldp#Container>; rel="type"/)
209209
.expect(200, done)
210210
})
211-
it('should serve the right content type if requested as text/html', function (done) {
211+
it('should load skin (mashlib) if resource was requested as text/html', function (done) {
212212
server.get('/sampleContainer/example1.ttl')
213213
.set('Accept', 'text/html')
214-
.expect('content-type', /text\/turtle/)
215-
.expect(200, done)
214+
.expect('content-type', /text\/html/)
215+
.expect(function (res) {
216+
if (res.text.indexOf('TabulatorOutline') < 0) {
217+
throw new Error('did not load the Tabulator skin by default')
218+
}
219+
})
220+
.expect(200, done) // Can't check for 303 because of internal redirects
216221
})
217222
it('should redirect to defaultApp if container was requested as text/html', function (done) {
218223
server.get('/sampleContainer/')

0 commit comments

Comments
 (0)