Skip to content

Commit

Permalink
contentType
Browse files Browse the repository at this point in the history
  • Loading branch information
bourgeoa committed Dec 12, 2023
1 parent be64c40 commit 86c6f5d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/sourcePane.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,15 @@ module.exports = {
// Set in refresh()
let contentType, allowed, eTag // Note it when we read and use it when we save

// from humanReadablePane see source-pane issue#53
const cts = kb.fetcher.getHeader(subject.doc(), 'content-type')
contentType = cts ? cts[0] : null
if (contentType) {
console.log('sourcePane: c-t:' + contentType)
} else {
console.log('sourcePane: unknown content-type?')
}

const div = dom.createElement('div')
div.setAttribute('class', 'sourcePane')
const table = div.appendChild(dom.createElement('table'))
Expand Down Expand Up @@ -324,7 +333,8 @@ module.exports = {
// get response headers
function getResponseHeaders (response) {
if (response.headers && response.headers.get('content-type')) {
contentType = response.headers.get('content-type').split(';')[0] // Should work but headers may be empty
// do not work on CSS see source-pane issue#53
// contentType = response.headers.get('content-type').split(';')[0] // Should work but headers may be empty
allowed = response.headers.get('allow')
eTag = response.headers.get('etag')
} else {
Expand Down

0 comments on commit 86c6f5d

Please sign in to comment.